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

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

问题描述

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



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


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



类型'System.Data.Entity.Core.Objects.ObjectResult(Of
DataLibrary.MyStoredProc_Result)'的值不能转换为
'System.Data 。对象对象(Of
DataLibrary.MyStoredProc_Result)'。


我无法弄清楚为什么这不会工作 - 开箱即用



EF 5有这样的问题。



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



任何想法?



编辑



答案是为VS 2012安装EF6工具。我不知道我不得不这样做,因为我以为已经安装当我添加了实体框架包。

解决方案

我猜你使用的是VS2012的EF工具, (.NET框架的一部分)。 EF6使用带外分发,并不适用于以前的工具 - 这就是为什么这些类型有一点点命名空间,不能从一个转换到另一个的原因。



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


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:

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

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 had so such issues.

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

Any ideas?

EDIT:

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.

解决方案

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.

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

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

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