Entity Framework 6 将存储过程添加到数据模型后无法构建 [英] Entity Framework 6 Cannot build after adding stored procedures to data model

查看:12
本文介绍了Entity Framework 6 将存储过程添加到数据模型后无法构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚下载了实体框架 6 并创建了一个全新的项目来测试它.我们目前使用的是 EF 5.

I just downloaded entity framework 6 and created a brand new project to test it. We currently use EF 5.

添加所有表和存储过程后,我尝试构建项目但出现错误:

After adding all my tables and stored procedures, I tried to build the project but I get errors:

System.Data.Objects.ObjectParameter"类型的值不能转换为System.Data.Entity.Core.Objects.ObjectParameter".

Value of type 'System.Data.Objects.ObjectParameter' cannot be converted to 'System.Data.Entity.Core.Objects.ObjectParameter'.

'System.Data.Entity.Core.Objects.ObjectResult(OfDataLibrary.MyStoredProc_Result)' 无法转换为'System.Data.Objects.ObjectResult(的DataLibrary.MyStoredProc_Result)'.

Value of type 'System.Data.Entity.Core.Objects.ObjectResult(Of DataLibrary.MyStoredProc_Result)' cannot be converted to 'System.Data.Objects.ObjectResult(Of DataLibrary.MyStoredProc_Result)'.

我不明白为什么这不能开箱即用

I cannot figure out why this will not work out-of-the-box

EF 5 就有这样的问题.

EF 5 had so such issues.

我正在使用 VS 2012..Net 4.5 Vb.net(也尝试使用 C# 项目...同样的问题)

I am using VS 2012. .Net 4.5 Vb.net (also tried with a C# project... same issue)

有什么想法吗?

编辑:

答案是为 VS 2012 安装 EF6 工具.我不知道我必须这样做,因为我认为在添加实体框架包时已安装.

The answer was to install EF6 Tools for VS 2012. I did not know I had to do this since I thought that was installed when I added the Entity Framework package.

推荐答案

我猜你正在使用 VS2012 的 EF 工具,这些工具仍然绑定到原始 EF 发行版(.NET 框架的一部分).EF6 使用带外分发,它不适用于以前的工具 - 这就是为什么这些类型的命名空间略有不同并且无法从一种转换到另一种的原因.

I guess you are using EF tools from VS2012 which are still bound to original EF distribution (part of .NET framework). EF6 uses out-of-band distribution and it doesn't work with previous tooling - that is the reason why those types has little bit different namespaces and cannot be converted from one to another.

解决方案应该是下载和安装 EF6 VS2012 工具或使用 VS2013应该包括工具的地方.

Solution should be downloading and installing EF6 tools for VS2012 or using VS2013 where tools should be included.

这篇关于Entity Framework 6 将存储过程添加到数据模型后无法构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆