2013-07-04 126 views
0

我已经在ASP.NET MVC4中创建了我的对象,并且在运行应用程序之后,只会自动创建UserProfile表,而不是另一个对应我的类。实体框架“Code First”不创建数据库表

遵循了这一忠告:Entity Framework 4.1 Code First not creating tables和得到这个错误:

Model compatibility cannot be checked because the database does not contain model metadata. Model compatibility can only be checked for databases created using Code First or Code First Migrations.

问题1:什么是代码优先的方法来做到这一点的正确方法是什么?

问题2:为什么创建了内置的UserProfile,而不是我的对象的表?什么改变了?

+0

你能否提供你的其他课程?你有适当的数据注释吗? – bdoshi

+0

你可以发布你的上下文吗? – SOfanatic

回答

1

请阅读我的回答here ...我认为同样的情况。创建UserProfile表,其他未创建。我的猜测是,您已切换到实际的MSSQL数据库而不是本地数据库,但尚未将您的WebSecurity数据库初始化指向新数据库。

相关问题