问题描述
我已经完成了以下步骤:
- 打开视觉工作室
- 创建新项目
- 选择ADO.Net实体数据模型
- 将其指向现有数据库
- 接受所有默认值。
- 然后在我的解决方案中添加一个Model1.edmx文件,并将相应的Model1 .Designer.cs文件。
I've done the following steps:- Open visual studio
- Create new item
- Select "ADO.Net Entity Data Model"
- Point it to an existing database
- Accept all the defaults.
- It then adds a "Model1.edmx" file to my solution and the corresponding "Model1.Designer.cs" file.
但是在输出中我收到以下错误:
错误:由于以下异常,无法生成模型:值不会下降在
However in the output I get the following error:
"ERROR: Unable to generate model because of the following exception: 'Value does not fall within the expected range.'."
我从这个数据库创建了一个模型,所以我不认为错误是复杂的表设计的结果(它不是)。
I've created a model from this database before so I dont think the error is a result of complex table design (which it's not).
有没有人打过这个错误?
Has anyone else hit this error?
谢谢
推荐答案
我也有类似的问题。原因很简单。我忘了在我的一个表中设置一个主键。希望有帮助。
I had a similar problem. The reason was pretty simple. I've forgotten to set a primary key in one of my tables. Hope it helps.
这篇关于Ado.Net实体数据模型不正确更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!