How to call Stored Procedure in Entity Framework 6 (Code-First)?

前端 未结 21 2078
滥情空心
滥情空心 2020-11-22 05:04

I am very new to Entity Framework 6 and I want to implement stored procedures in my project. I have a stored procedure as follows:

ALTER PROCEDURE [dbo].[ins         


        
21条回答
  •  心在旅途
    2020-11-22 05:53

    public IList GetRequisitionDetailBySearchCriteria(Guid subGroupItemId, Guid groupItemId)
    {
        var query = this.UnitOfWork.Context.Database.SqlQuery("SP_GetRequisitionDetailBySearchCriteria @SubGroupItemId,@GroupItemId",
        new System.Data.SqlClient.SqlParameter("@SubGroupItemId", subGroupItemId),
        new System.Data.SqlClient.SqlParameter("@GroupItemId", groupItemId));
        return query.ToList();
    }
    

提交回复
热议问题