c# - Database.SetInitializer(new MigrateDatabaseToLatestVersion<Context, Configuration>()); Error -


well error getting compiler error

cs0311: there no implicit reference conversion from...

i enabled migrations package manager

 public class configuration : dbmigrationsconfiguration<pmdbcontext>  {      public configuration()      {          automaticmigrationsenabled = true;          automaticmigrationdatalossallowed = true;          contextkey = "context.db.context";      }       protected override void seed(pmweb.models.pmdbcontext context)      {          //  method called after migrating latest version.          //  can use dbset<t>.addorupdate() helper extension method           //  avoid creating duplicate seed data. e.g.          //          //    context.people.addorupdate(          //      p => p.fullname,          //      new person { fullname = "andrew peters" },          //      new person { fullname = "brice lambson" },          //      new person { fullname = "rowan miller" }          //    );          //      }  } 

and statement:

database.setinitializer(new migratedatabasetolatestversion<dbcontext, configuration>());  

generates following error:

error 4 type 'pmweb.migrations.configuration' cannot used type parameter 'tmigrationsconfiguration' in generic type or method 'system.data.entity.migratedatabasetolatestversion'. there no implicit reference conversion 'pmweb.migrations.configuration' 'system.data.entity.migrations.dbmigrationsconfiguration'. f:\dropbox\partymag\pmweb\models\pmdbcontext.cs 52 83 pmweb

btw, working fine before, not know changed.

database.setinitializer(new migratedatabasetolatestversion<pmdbcontext, configuration>());  

i supposed give context not base context class. silly me. :)


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -