如何在 Entity Framework Core 中运行存储过程? [英] How to run stored procedures in Entity Framework Core?
本文介绍了如何在 Entity Framework Core 中运行存储过程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 ASP.NET Core 应用程序中使用 EF Core 1.0.你能指出我执行存储过程的正确方法吗?带有 ObjectParameters
和 ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction
的旧方法不起作用.
I am using EF Core 1.0 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.
推荐答案
现在解决了 EF Core 1.0 中对存储过程的支持,这也支持多个结果集的映射.
Support for stored procedures in EF Core 1.0 is resolved now, this also supports the 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屋!
查看全文