如何在Entity Framework Core中运行存储过程? [英] How to run stored procedures in Entity Framework Core?

查看:271
本文介绍了如何在Entity Framework Core中运行存储过程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ASP.NET Core应用程序中使用EF7(实体框架核心).您能给我指出执行存储过程的正确方法吗? ObjectParameters((IObjectContextAdapter)this).ObjectContext.ExecuteFunction的旧方法不起作用.

I am using EF7 (Entity Framework Core) in an ASP.NET Core App. Can you please point me to the proper way of executing stored procedures? The old method with ObjectParameters and ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction is not working.

推荐答案

现在已经解决了对EF7中存储过程的支持,它还支持多个结果集的映射.

Support for stored procedure in EF7 is resolved now, this also supports mapping of multiple result-sets.

在此处查看修复详细信息

您可以在c#中这样称呼它

And you can call it like this in c#

var userType = dbContext.Set().FromSql("dbo.SomeSproc @Id = {0}, @Name = {1}", 45, "Ada");

这篇关于如何在Entity Framework Core中运行存储过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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