EFCore 迁移

 逆向迁移 Db First(数据库——实体)

一,更新DbContext
  
Scaffold-DbContext '连接字符串' Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -force

  

二,与数据库字段大小写同步(-usedatabasename)

 

 Scaffold-DbContext '连接字符串' Microsoft.EntityFrameworkCore.SqlServer  -OutputDir Models -force -usedatabasename

  

 三,初始化DBContext

 

Scaffold-DbContext "连接字符串" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models

  

Code First(实体——数据库)

 dotnet ef migrations

dotnet ef database

dotnet ef dbcontext

 

posted @ 2018-07-20 13:54  NICETOMEETYOUSEVEN  阅读(253)  评论(0编辑  收藏  举报