1. 创建基于.net core 的项目(过程略)

2. 使用nuget添加引用

Microsoft.EntityFrameworkCore

Microsoft.EntityFrameworkCore.Tools

Microsoft.EntityFrameworkCore.Design

Microsoft.EntityFrameworkCore.SqlServer
Microsoft.EntityFrameworkCore.SqlServer.Design

.net core ef 通过dbfirst方式连接sql server数据库

 

3. 在程序包管理器控制台执行语句

Scaffold-DbContext "Server=***;User Id=***;Password=***;Database=***;Persist Security Info=True;" Microsoft.EntityFrameworkCore.SqlServer -o Models -f

注意:

要选中默认项目

-o 后面指定文件夹,

-f 表示是否覆盖原文件

-t 后面跟表名

.net core ef 通过dbfirst方式连接sql server数据库

 

相关文章:

  • 2021-11-30
  • 2021-09-03
  • 2021-10-20
  • 2021-09-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-26
  • 2021-10-02
  • 2022-12-23
  • 2021-11-28
  • 2022-12-23
相关资源
相似解决方案