Enable-Migrations - ConfigurationTypeName namespace.DbContext

Enable-Migrations命令创建了一个新的Migrations文件夹,并在该目录下创建了Configuration.cs文件,其中的Seed方法是向表中插入初始化数据的。

Update-Database –TargetMigration: name 运行指定的数据库版本,name是指定的名字。

PM> update-database -v

PM> update-database -ConfigurationTypeName namespace.Configuration

PM> update-database -ConfigurationTypeName namespace.Configuration

PM> Add-Migration -ConfigurationTypeName namespace.Configuration InitDB

PM> update-database -ConfigurationTypeName namespace.Configuration

参考:https://www.cnblogs.com/panchunting/p/entity-framework-code-first-migrations.html

posted on 2018-07-19 21:26  邢帅杰  阅读(178)  评论(0编辑  收藏  举报