Create Tables on runtime in EF Core

前端 未结 3 1502
时光取名叫无心
时光取名叫无心 2020-12-30 07:05

I know I can use the following command to add a new migration and create the database :

dotnet ef migrations add MigrationName -c DbContextName
dotnet ef data         


        
3条回答
  •  清歌不尽
    2020-12-30 07:17

    Instead of DbContext.Database.Migrate() I should use DbContext.Database.EnsureCreated() method.

提交回复
热议问题