实体框架生成的存储过程签名的表示是Int而不是记录集 [英] Entity Framework generated representation of a stored procedure signature is an Int instead of a record set

查看:87
本文介绍了实体框架生成的存储过程签名的表示是Int而不是记录集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的存储过程实现很简单:

My stored procedure implementation is simple:

create Procedure [dbo].[GetNegotiationInfo] (
    @negotiationId uniqueidentifier
) As

    select NegotiationId, SellerId from NegotiationMaster where negotiationId = @negotiationId

然后,我希望在更新我的模型后写下面的代码。

Then I expected to be to write the following code after updating my model.

   using (var db = new NegotiationContext())
            {
var query = db.GetNegotiationInfo(NegotiationId).FirstOrDefault();
}

但是我收到错误int不包含FirstOrDefault的定义)。我知道实体框架可能无法生成复杂的存储过程与临时表等,但显然我的存储过程不会比这更简单。请注意,我的存储过程对于我的StackOverflow问题是基本的,而不是我将要使用的实际存储过程。

But I am getting the error "int does not contain a definition for FirstOrDefault()". I know that Entity Framework can have trouble generating complex stored procedures with temp tables etc but obviously my stored procedure doesn't get any simpler than this. Please note my stored procedure is this basic for my StackOverflow question and is not the actual stored procedure I will be using.

推荐答案

它的所有关于在Visual Studio模型浏览器中编辑功能导入,并为返回记录集创建一个复杂类型。注意,存储过程中的临时表对于Entity Framework来说很难检查。请参阅 MSDN

Its all about editing the "Function Import" in the Visual Studio Model Browser and creating a complex type for the return record set. Note, temp Tables in your stored procedure will be difficult for Entity Framework to inspect. see MSDN

这篇关于实体框架生成的存储过程签名的表示是Int而不是记录集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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