-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
Describe what is not working as expected.
Store procedure output parameter is not working as expected. The output value is always null.
I have an statement like this. I've removed other parameters except this OUTPUT param to pointing out the issue. The records are came but the the value of this OUTPUT parameter is null without the exception. Executing the proc in SSMS works just fine but with this FromSql(...) isn't doing anything for output parameter.
-- other param are working as expected but the OUTPUT is not so i hide them.
@todoCounts VARCHAR(MAX) OUTPUTvar items = _context.Set<T>().FromSql("Sp_Todo @todoCounts OUTPUT",
new SqlParameter("@todoCounts", SqlDbType.VarChar)
{ Direction = ParameterDirection.Output}).ToList() // no luckIf i add this too, then the output value coming but this is not the correct idea here. I am not seeing any exceptions.
_context.Database.ExecuteSqlCommand("Sp_Todo @todoCounts OUTPUT",
new SqlParameter("@todoCounts", SqlDbType.VarChar)
{ Direction = ParameterDirection.Output});If you are seeing an exception, include the full exceptions details (message and stack trace).
none
Steps to reproduce
- Create a store procedure with output parameter.
@todoCounts VARCHAR(MAX) OUTPUT- Execute the StoreProc like this.
// records retrieved except OUTPUT parameter.
context.set<MyModel>().FromSql("Sp_Todo @todoCounts OUTPUT",
new SqlParameter("@todoCounts", SqlDbType.VarChar)
{ Direction = ParameterDirection.Output}).ToList() Further technical details
EF Core version: 1.1.2
Database Provider: 1.1.2
Operating system: Windows 10
IDE: Visual Studio 2017 15.2(2643.16) release