mskuratowski
mskuratowski

Reputation: 4124

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

Upvotes: 1

Views: 151

Answers (1)

ErikEJ
ErikEJ

Reputation: 41759

You can use this while testing/developing:

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

Upvotes: 1

Related Questions