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

后端 未结 10 1922
梦谈多话
梦谈多话 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:42

    Also, you can use the "sql" parameter as a format specifier:

    context.Database.SqlQuery("mySpName @param1 = {0}", param1)
    

提交回复
热议问题