public MyContext() { Database.SetInitializer<MyContext>(null); }
但这只是解决不报下列错: The model backing the 'MyContext' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269).
执行 Update-Database 依旧问题多多。
[其他解释] 如果项目变大了, 还是该换成 model first 吧。
你说的情况,就是非常适合 model first: 对同一个的数据库, 每个项目都有自己的 edmx [其他解释]
http://blog.csdn.net/cityhunter172/article/details/8062420 这是我写的博客《Code First Migrations 更新数据库结构的具体步骤》,我项目引用的就是 EF5,我目前正在看 EF6 的文档,希望能找到解决方案。 http://blogs.msdn.com/b/adonet/archive/2012/10/30/ef6-alpha-1-available-on-nuget.aspx [其他解释] Multi-Tenant Migrations - In previous versions of EF you were limited to one Code First model per database when using Migrations, this limitation is now removed. If you want to know more about how we enabled this, check out the feature specification on CodePlex.
以上是 EF6 的新功能,"limited to one Code First model per database",看到这句话,大家也许就明白了,EF5 以前的版本中做了限定,一个数据库只允许一个 Code First model。 [其他解释] 学习学习~帮顶~ [其他解释] null