代码优先迁移失败

时间:2013-04-28 15:04:35

标签: asp.net-mvc-4 ef-migrations entity-framework-6

我遵循了tutorial

然后做了

Update-Database -Force -Verbose

它显示它升级了表格。 但是会显示错误:

The model backing the 'DbConnection' context has changed 
since the database was created.
Consider using Code First Migrations to update the database
(http://go.microsoft.com/fwlink/?LinkId=238269).

我也试过

Enable-Migrations -ContextTypeName MvcApplication6.Models.DbConnection

然而它说:

Migrations have already been enabled in project 'MvcApplication6'. 
To overwrite the existing migrations configuration, use the -Force parameter.

任何想法我做错了什么?

1 个答案:

答案 0 :(得分:0)

我找到了解决方案here

Database.SetInitializer<DbConnection>(null);