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
Post a Comment