实体模型问题:无法为一个特定表创建模型
在创建实体模型时,我收到以下错误。
Added the connection string to Web.Config.
Successfully registered the assembly 'System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' in Web.Config.
ERROR: Unable to generate model because of the following exception: 'Value does not fall within the expected range.'.
Loading metadata from database took 00:00:02.1203632.
Generating model took 00:00:00.8390920.
Writing out the EDMX file took 00:00:00.
所有表都已创建,但 BC_States 表未创建。我不明白为什么。
While creating the entity model I am getting the following error .
Added the connection string to Web.Config.
Successfully registered the assembly 'System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' in Web.Config.
ERROR: Unable to generate model because of the following exception: 'Value does not fall within the expected range.'.
Loading metadata from database took 00:00:02.1203632.
Generating model took 00:00:00.8390920.
Writing out the EDMX file took 00:00:00.
All the tables are getting created but the BC_States table is not getting created.I can't understand why.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我刚刚在调查类似的问题。事实证明,实体框架在 Visual Studio 中的
Error List
窗口的Messages
部分中输出了额外的错误信息。正如您所看到的,它比
Output
窗口中出现的一般错误有用得多。这对于帮助我解决问题至关重要。I've just been investigating a similar issue. It turns out that Entity Framework outputs additional error information in the
Messages
section of theError List
window in Visual Studio.As you can see it's much more useful than the generic error that appears in the
Output
window. This was crucial in helping me to solve my problem.该问题不可读,但我在 Ado.Net 实体数据模型未正确更新 中发现了类似的问题。
对于我来说(我有同样的问题),问题是因为其中一张表上没有设置主键。
The question is not readable but I found the similar question at Ado.Net Entity Data Model Not Updating Correctly.
As for me (I had the same problem) the issue was because of there was no primary key set on one of the tables.