i using ef 6.1.2, code based db migration there commands need excecute. are: add-migration , update-database. want migration happen in production environment. there way avoid update-database command in package manager console , use c# apis same? can not use update-database command in production environment. , want aleternate in c#.
there obvious alternative, can have migratedatabasetolatestversion particular db context. 
this way migration happens automatically when first query executed against database. have separate commandline tool same executed @ production environment on demand (rather when app executes first query), prior application.
the initializer straightforward use, call:
database.setinitializer(            new migratedatabasetolatestversion<yourcontext, configuration>());   where configuration class keeps configuration of migrations.
Comments
Post a Comment