EFCore迁移命令

DbFirst:

 Microsoft.EntityFrameworkCore

Microsoft.EntityFrameworkCore.Design

Microsoft.EntityFrameworkCore.SqlServer

Microsoft.EntityFrameworkCore.SqlServer.Design

Microsoft.EntityFrameworkCore.Tools

 

生成:
Scaffold-DbContext -Connection "Server=.;Database=WriteAspNetCoreDataBase;uid=sa;pwd=sa123" Microsoft.EntityFrameworkCore.SqlServer -OutputDir "Models"
 

Migration:

context.Database.EnsureDeleted(); //删除数据库

context.Database.EnsureCreated(); //创建数据库和表

 

add-migration Init02

update-database

 

dotnet ef migrations add Init07

dotnet ef database update

 

 

 

 

posted @ 2020-05-28 16:45  FiberHomer  阅读(348)  评论(0编辑  收藏  举报