功能进口在实体模型与非实体返回类型 [英] Function Imports in Entity Model with a non-Entity Return Type

查看:160
本文介绍了功能进口在实体模型与非实体返回类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的实体数据模型和<一个存储过程href="http://techen$c$cr.com/wp-content/uploads/2009/02/entity-data-model-add-function-import.png">added它的功能的进口的。

I have a stored procedure in my Entity Data Model and added it to the function imports.

问题是...的Visual Studio生成函数code模型的code-后面当且仅当我指定的返回是一个实体类型。 标量和空返回类型不工作。 Visual Studio中不产生当我选择它的函数code。

Problem is ... Visual Studio generates the function code in the model's code-behind if and only if I specify the return to be an entity type. Scalar and null return types do not work. Visual Studio does not generate the function code when I choose them.

有我丢失的东西,或者这是一个错误?
任何变通办法?

Is there something I am missing, or is this a bug?
Any work-arounds?


使用Visual Studio 2008 v9.0.30729.1 SP(服务包1)


Using Visual Studio 2008 v9.0.30729.1 SP (Service Pack 1)

推荐答案

这与其说是一个错误,因为它是缺乏一个功能。实体框架只是不支持存储过程返回标量值的现在。我认为这是应该改变在.NET 4.0中。在此期间,您可以通过CreateDbCommand.

It's not so much a bug as it is the lack of a feature. The Entity Framework just doesn't support stored procedures returning scalar values right now. I believe this is supposed to change in .NET 4.0. In the meantime, you can execute such a stored procedure by using the store connection, available via CreateDbCommand.

这篇关于功能进口在实体模型与非实体返回类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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