.net core 学习- EF利用实体类生成数据表(sqlserver)

以下步骤针对SqlServer

step1: 项目安装NutGet包:Microsoft.EntityFrameworkCore.SqlServer

step2: 打开程序程序包管理控制器,输入以下命令 

Add-Migration v1.0.0 -Context DbContext
update-database v1.0.0 -Context DbContext

Add-Migration 命令:会在项目中生成对应迁移文件

update-database 命令:根据迁移文件向数据库写入数据表

posted @ 2021-08-28 18:37  刘德军  阅读(354)  评论(0)    收藏  举报