entity framework - How to seperate Initializer method for various environments -


i new ef code first.

i've project in i've created initializer class derived createdatabaseifnotexists, dropcreatedatabaseifmodelchanges, dropcreatedatabasealways or custom db initializer.

i've used "dropcreatedatabaseifmodelchanges" development purpose, it's recreate database whenever model changes , it's during development, time deploy qa , production environment.

my idea keep development

namespace models {     public class schoolinitializer : dropcreatedatabaseifmodelchanges<schoolcontext>     {         protected override void seed(schoolcontext context)         {         }     }  } 

and qa or production

namespace models {     public class schoolinitializer : createdatabaseifnotexists<schoolcontext>     {         protected override void seed(schoolcontext context)         {         }     }  } 

how achive using app.config file. when pubish qa or release, should change automatically.

thanks.

use slowcheetah package, enables transform app.config.

for example of how transformations: https://stackoverflow.com/a/13203775/441292


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -