Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 28, 2012 09:19 AM by GorillaMann
Member
117 Points
332 Posts
Nov 27, 2012 05:20 PM|LINK
Hi, do I need to have this in my web config,
<databaseInitializer type="System.Data.Entity.MigrateDatabaseToLatestVersion`2[[blah blah
if I aleady set up my context like this
Database.SetInitializer(new MigrateDatabaseToLatestVersion<DB, Configuration>()); base.OnModelCreating(modelBuilder);
<contexts> <context type="Blogging.BlogContext, MyAssembly"> <databaseInitializer type="System.Data.Entity.MigrateDatabaseToLatestVersion`2[[Blogging.BlogContext, MyAssembly], [Blogging.Migrations.Configuration, MyAssembly]], EntityFramework" /> </context> </contexts>
All-Star
118619 Points
18779 Posts
Nov 28, 2012 04:35 AM|LINK
Hello,
No, you don't need to do such a configuration but just implement the interface of IDataBaseInitializer or inherit from DataContext——if your "MigrateDatabaseToLatestVersion" class already exists and you've used the Namespace into your own proj.
Nov 28, 2012 09:19 AM|LINK
Thanks again Decker!
GorillaMann
Member
117 Points
332 Posts
Do I need MigrateDatabaseToLatestVersion in web config
Nov 27, 2012 05:20 PM|LINK
Hi, do I need to have this in my web config,
<databaseInitializer type="System.Data.Entity.MigrateDatabaseToLatestVersion`2[[blah blah
if I aleady set up my context like this
Database.SetInitializer(new MigrateDatabaseToLatestVersion<DB, Configuration>());
base.OnModelCreating(modelBuilder);
<contexts> <context type="Blogging.BlogContext, MyAssembly"> <databaseInitializer type="System.Data.Entity.MigrateDatabaseToLatestVersion`2[[Blogging.BlogContext, MyAssembly], [Blogging.Migrations.Configuration, MyAssembly]], EntityFramework" /> </context> </contexts>
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Do I need MigrateDatabaseToLatestVersion in web config
Nov 28, 2012 04:35 AM|LINK
Hello,
No, you don't need to do such a configuration but just implement the interface of IDataBaseInitializer or inherit from DataContext——if your "MigrateDatabaseToLatestVersion" class already exists and you've used the Namespace into your own proj.
GorillaMann
Member
117 Points
332 Posts
Re: Do I need MigrateDatabaseToLatestVersion in web config
Nov 28, 2012 09:19 AM|LINK
Thanks again Decker!