c# - Visual Studio 2013 创建 EDMX 文件时出错

标签 c# entity-framework visual-studio-2013 edmx edmx-designer

在 Visual Studio 2013(Update 2 和更高版本 Update 4)中,使用 Entity Framework 6.1.2,我在创建 EDMX 文件时遇到问题。

创建文件时,我添加了一个新项目,选择“ADO.NET 实体数据模型”,无论我创建的是“空 EF 设计器模型”还是“来自数据库的 EF 设计器”(也不管是哪个数据库如果建立数据库,我可能会选择)我收到一条非常一般的错误消息:

"Operation is not valid due to the current state of the object"

它让我回到添加新项目向导。 *.edmx 已生成,但如果我尝试打开生成的 *.edmx 文件,我会收到另一条通用消息:

"The operation could not be completed."

*.designer.cs 文件似乎已填充,但并非所有程序集引用都已添加到项目中;必须手动添加 System.Data.Entity 才能引用 System.Data.Objects 进行解析。

我已经为两个版本的 Visual Studio 安装了 Entity Framework 6 Tools for Visual Studio 2012 & 2013。我已经尝试对绑定(bind)到 TFS 和未绑定(bind)的项目执行此操作,但在任何一种情况下错误仍然存​​在。

如果我在 Visual Studio 2012 中打开解决方案,同样的错误仍然存​​在。我能够在 Visual Studio 2010 中成功添加一个 *.edmx 文件,然后稍后在 Visual Studio 2013 中打开该项目,并且 *.edmx 文件存在并且可以访问;它打开并且我可以查看它,但是如果我移动或编辑,我会收到以下错误:

"XmlModels involved in this transaction are not editable."

有没有人对正在发生的事情有任何建议,或者我的环境中可能缺少什么?我对我的系统上设置不当的地方一头雾水。

最佳答案

基于错误“XmlModels involved in this transaction are not editable”,我能够找到对类似问题的响应:

Entity Framework Unable to refresh database tables under TFS 2010

简而言之,我的项目和解决方案存储在磁盘上 C:\Code\C#\Application\[etcetera]

问题是解决方案/项目/文件路径中的“#”字符。快速将解决方案复制到 C:\Code\CSharp\[etcetera] 解决了添加和编辑现有 *.edmx 文件的问题。

我正在回复 preserve the Wisdom of the Ancients .

关于c# - Visual Studio 2013 创建 EDMX 文件时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28240327/

相关文章:

c# - Monotouch AVAssetReader

c# - 我的 C# 代码在 Visual Studio 2013 上无法正常工作

c# - ViewModel 和 Command 之间的通信

c# - 使用 ASP MVC 下载并显示私有(private) Azure Blob

C#线程问题

entity-framework - 再次为新的 MVC 3 项目使用 LINQ to SQL 或 Entity Framework

c# - Linq 加入包含语句

c# - MySql Connector 6.8.2 RC、Entity Framework 6 和 Code First

c# - 在哪里将 ImplicitlyExpandDesignTimeFacades 设置为 false?

sharepoint - 在 Visual Studio 2013 中创建 Sharepoint 2010 解决方案