How to use DbContext.Database.SqlQuery(sql, params) with stored procedure? EF Code First CTP5

后端 未结 10 1880
梦谈多话
梦谈多话 2020-11-22 16:53

I have a stored procedure that has three parameters and I\'ve been trying to use the following to return the results:

context.Database.SqlQuery

        
10条回答
  •  臣服心动
    2020-11-22 17:56

    I use this method:

    var results = this.Database.SqlQuery("EXEC [ent].[GetNextExportJob] {0}", ProcessorID);
    

    I like it because I just drop in Guids and Datetimes and SqlQuery performs all the formatting for me.

提交回复
热议问题