How to call a stored procedure in EF Core 3.0 via FromSqlRaw

后端 未结 6 1148
失恋的感觉
失恋的感觉 2020-12-03 14:04

I recently migrated from EF Core 2.2 to EF Core 3.0.

Unfortunately, I haven\'t found a way to call a stored procedure that returns an entity.

In EF Core 2.

6条回答
  •  情书的邮戳
    2020-12-03 14:52

    try to seperate SqlParameter:

    SqlParameter param1 = new SqlParameter("@p0","value");
    SqlParameter param2 = new SqlParameter("@p1","value");
    
    var createdPath = ModelContext.Paths.FromSqlRaw("AddNodeWithPathProc @p0 @p1", param1, 
    param2).Single();
    

提交回复
热议问题