实体框架:调用存储过程而不进行映射 [英] Entity Framework: Call a stored procedure without mapping

查看:58
本文介绍了实体框架:调用存储过程而不进行映射的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以使用存储过程而不使用Entity Framework函数映射,这很棒,但是当对存储过程进行任何更改时,这完全是垃圾,我知道您可以刷新存储过程映射,但是只是效率不高。在大多数情况下,更新映射时不会发现非常烦人的更改。

Is there a way to use stored procedures without using the Entity Framework function mapping, which is great but is a complete load of rubbish when any changes are added to the stored procedure, I am aware you can refresh the stored procedure mapping but it's just not efficient. Most of the time when you update your mappings it does not pick up the changes which is extremely annoying.

到目前为止,我已经尝试了以下操作:

so far I have tried the following:

 var List = db.ExecuteStoreQuery<Business_Voucher_Top5_Result1>("exec usp_BusinessVoucher_Top5");    

这很好用,但是我可以在不创建映射并将参数传递给它的情况下做到吗?

this works great but can I do it without creating the mapping and pass parameters to it?

谢谢

推荐答案

您无需为<$ c创建映射$ c> ExecuteStoreQuery -您只需要使用一种类型的属性,该属性的名称与结果集中的列相同。

You don't need to create mapping for ExecuteStoreQuery - you just need to use a type which has properties with same names as columns in the result set.

这篇关于实体框架:调用存储过程而不进行映射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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