Executing a stored procedure that returns a result set and has output parameters with Entity Framework

c# entity-framework entity-framework-6 stored-procedures

Question

I have a stored process that was created a few years ago that returns a result set with output parameters. In EntityFramework, I'm attempting to use it. When I first imported it, the created code utilizedExecuteFunction() to carry out the process. By using this approach, theObjectParameter The output parameter values were in objects. I then modified the model's specification of the imported procedure to produce a complex type I specified there that corresponds to the result set the stored function returns. To carry out the procedure, the resulting code was modified to useExecuteFunction<MyComplexType>() the process returns the current result set in anIEnumerable<MyComplexType> . But myObjectParameter objects' default settings I did not set them to the procedure's output, but rather the time I created them.

In my model, I've made a second mapping of the function that isn't configured to return a complex type. I'm currently using these two routines to run the stored process twice. The complex type is not returned by the initial execution. It determinesObjectParameter values. I then go past theseObjectParameters I have the output of the stored procedure as well as the result data from these two executions of the second function.

Am I performing incorrectly? Or is this an Entity Framework 6 limitation?

1
1
3/2/2015 8:20:03 PM

Accepted Answer

It turns out that until all of the results are read, the output parameters aren't available. My issue was resolved by adding.ToList() towards the tend of theExecuteFunction() call. I discovered it by looking through Visual Studio's information. The pertinent paperwork is available here:

enter image description here

I'm not sure why I can't find this mentioned in the official material on MSDN.

https://msdn.microsoft.com/en-us/library/bb739018(v=vs.110).aspx

1
3/3/2015 7:20:28 PM

Popular Answer

ZZZ_tmp


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow