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.
Use Database.SetInitializer(new DropCreateDatabaseIfModelChanges<StudentDbContext>());