Search code examples
asp.net-coreasp.net-core-mvcentity-framework-core

How to run stored procedures in Entity Framework Core?


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.


Solution

  • Support for stored procedures in EF Core 1.0 is resolved now, this also supports the mapping of multiple result-sets.

    Check here for the fix details

    And you can call it like this in c#

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