Entity Framework Core-DBFirst方式生成SQL Server实体对象

生成语句:
Scaffold-DbContext "Server=.;Database=BJFlatWareHouseDB_V2.0;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -ContextDir Context -Context DBContext -ContextNamespace New.Namespace

server:用于连接到数据库的连接字符串。这是一个位置参数,并且是必需的。
Microsoft.EntityFrameworkCore.SqlServer:要使用的提供程序。 通常,这是 NuGet 包的名称。这是一个位置参数,并且是必需的。

-OutputDir 要在其中放置文件的目录。 路径相对于项目目录。

-ContextDir 要在其中放置文件的目录 DbContext 。 路径相对于项目目录。

-ContextNamespace New.Namespace 要用于生成的类的命名空间 DbContext 。

posted @ 2020-12-25 19:58  ErShiXiong  阅读(136)  评论(0编辑  收藏  举报