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});
SqlDbType.VarChar
returns null.IQeryable<T>
You can see at_context.Set<T>()
IQueryable
, notIQeryable
. Also, you can use @ to mention people in comments. For example, @Robin.