简体   繁体   中英

Always re-create database

how can I re-create database every time when I run application or if any changes has been changed?

Should I use some method in dbcontext or in Startup.cs class?

I'm using asp.net core

You can use this while testing/developing:

dbContext.Database.EnsureDeleted();
dbContext.Database.EnsureCreated();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM