Reputation: 651
I have the following in my Web.config
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<contexts>
<context type="Models.EVRMDBContext, EVRM">
<databaseInitializer type="System.Data.Entity.DropCreateAlways`1[[Models.EVRMDBContext, EVRM]], EntityFramework" />
</context>
</contexts>
</entityFramework>
However as soon as I use/query my DBContext the database is not created. When I set the databaseInitializer in Global.asax using
System.Data.Entity.Database.SetInitializer(new System.Data.Entity.DropCreateDatabaseAlways<EVRM.Models.EVRMDBContext>());
It does initialize the database.
(Using Entity Framework 5 with MVC4)
Upvotes: 1
Views: 859
Reputation: 1110
There's a typo in the web.config, should be "System.Data.Entity.DropCreateDatabaseAlways" instead of "System.Data.Entity.DropCreateAlways"
Upvotes: 1