Using Entity Framework 6 using the first model installation using
Run the application created by the database. Woot!
Delete .mdf / .ldf in the App_Data folder.
Launch application, error connecting to database.
Why didn't he recreate the database?
PS I tried to do. How to recreate the database for the Entity Framework? but that will not work.
So, how can I convince EF to recreate the database (and why is it difficult?)?
, , MDF Windows. SQL Server LocalDb , , , MDF.
, SQL Server Management Studio SQL Server Visual Studio.
" " Visual Studio Solution Explorer, MDF App_Data, , Solution Explorer. Visual Studio, , SQL Server .
DbContext , , :
Database.SetInitializer<MyContext>(new CreateDatabaseIfNotExists<MyContext>()); Database.SetInitializer<MyContext>(new DropCreateDatabaseIfModelChanges<MyContext>()); Database.SetInitializer<MyContext>(new DropCreateDatabaseAlways<MyContext>());
DbContext.