实体模型问题:无法为一个特定表创建模型

发布于 2024-08-20 05:32:29 字数 528 浏览 8 评论 0原文

在创建实体模型时,我收到以下错误。

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

黎夕旧梦 2024-08-27 05:32:29

我刚刚在调查类似的问题。事实证明,实体框架在 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 the Error 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.

enter image description here

未蓝澄海的烟 2024-08-27 05:32:29

该问题不可读,但我在 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文