Create Tables on runtime in EF Core

前端 未结 3 1494
时光取名叫无心
时光取名叫无心 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:26

    If you need to create you model tables also if in your DB there are some other tables you can use

    RelationalDatabaseCreator databaseCreator = 
        (RelationalDatabaseCreator) context.Database.GetService();
    databaseCreator.CreateTables();
    

提交回复
热议问题