Bootstrap

EF数据迁移完整步骤

首选打开NeGet包管理器

1、在vs中的“程序包管理器控制台”中输入命令,先初始化迁移数据上下文和迁移目录  Core使用:EntityFrameworkCore\Enable-Migrations    EF使用:EntityFramework6\Enable-Migrations

2、增加迁移  Core使用:EntityFrameworkCore\Add-Migration InitSpiderDB    EF使用:EntityFramework6\Add-Migration InitSpiderDB

3、更新到数据库  Core使用:EntityFrameworkCore\update-database    EF使用:EntityFramework6\update-database

4、如果想删除迁移  Core使用:EntityFrameworkCore\Remove-Migration    EF使用:EntityFramework6\Remove-Migration

5、查看迁移帮助     Core使用:get-help entityframeworkcore    EF使用:get-help EntityFramework6v

;