Entity framework core Output parameter not working in store procedure using FromSql method (Linq)

Viewed 2703

I am trying to get output value from the dbcontext using the method FromSql(...).

If i execute it on SSMS, it works but not working in EF core.

My SP param:

  @totalItems VARCHAR(MAX) OUTPUT 

I've removed other params for readable and point out the issue. The records are coming but the OUTPUT parameter is always null.

Linq

IQeryable<T> = _context.Set<T>().FromSql("Sp_Todo @totalItems OUTPUT", // i also tried with OUT or without both Out/Output but no luck
 new SqlParameter("@totalItems", SqlDbType.Varchar)
 { Direction = ParameterDirection.Output});
1 Answers
Related