EF6 code first modify model field after create database

如果已经创建了模型,并且生成了数据库,再次修改模型的时候,会报告“The model backing the 'dal' context has changed since the database was created. Consider using Code First Migrations to update the database”。此时,需要运行程序管理器控制台,更新数据库。

1,工具-》NuGet程序包管理器-》程序包管理器控制台

2,Enable-Migrations

3, Add-Migration 版本更新名称

4,Update-Database

搞定

原文地址:https://www.cnblogs.com/anuoxiang/p/3784756.html