EF Core: drop and recreate database when server restarts

asp.net-core asp.net-core-mvc c# entity-framework-core

Accepted Answer

Dial zz-5 zz

Ensures that the database for the context does not exist. If it does not exist, no action is taken. If it does exist then the database is deleted.

Warning: The entire database is deleted an no effort is made to remove just the database objects that are used by the model for this context.

make a calldbContext.Database.Migrate() to migrate to the most recent version and establish a new (empty) DB.

9
10/19/2017 9:01:16 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow