Reputation: 1329
When I add this code Database.SetInitializer(new DropCreateDatabaseWhenModelChanges());
in DbContext file, I get the following error:
The type or namespace name 'DropCreateDatabaseWhenModelChanges' could not be found (are you missing a using directive or an assembly reference?)
I have included the System.Data.Entity namespace. What could I be missing? EDIT I tried with DropCreateDatabaseIfModelChanges, in vain.
Upvotes: 0
Views: 247
Reputation: 143
Use Database.SetInitializer(new DropCreateDatabaseIfModelChanges<StudentDbContext>());
Upvotes: 1
Reputation: 2126
you mean DropCreateDatabaseIfModelChanges
not DropCreateDatabaseWhenModelChanges
Upvotes: 0