Function Imports in Entity Model with a non-Entity Return Type(具有非实体返回类型的实体模型中的函数导入)
问题描述
我的实体数据模型中有一个存储过程,并将其添加到函数导入中.
I have a stored procedure in my Entity Data Model and added it to the function imports.
问题是...当且仅当我将返回指定为实体类型时,Visual Studio 才会在模型的代码隐藏中生成函数代码.标量和空返回类型不起作用.当我选择它们时,Visual Studio 不会生成函数代码.
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.
这篇关于具有非实体返回类型的实体模型中的函数导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:具有非实体返回类型的实体模型中的函数导入
基础教程推荐
- WPF 模态进度窗口 2022-01-01
- 如何使用 .Net 检查 Active Directory 服务器是否已启动并正在运行? 2022-01-01
- 禁止输入少量字符,例如'<'、'&a 2022-01-01
- C# 从 List<List<int>> 中删除重 2022-01-01
- .NET SerialPort DataReceived 事件未触发 2022-01-01
- Azure Functions:CosmosDBTrigger 未在 Visual Studio 中触发 2022-01-01
- 如果有人提交恶意软件Nuget包怎么办? 2022-01-01
- Moq It.Is<>不匹配 2022-01-01
- 我应该在后面的代码中直接使用 Linq To SQL 还是使 2022-01-01
- 当值可以是对象或空数组时反序列化 JSON 2022-01-01
