0

I have a stored procedure uspGetProductAndCategory which is accepting a parameter @SupplierID and returns the products, categories and suppliers [these tables from the NorthWindDatabase].

My problem is when I am integrating this stored procedure with an .edmx it's generating one method in my ContextEntityClass as uspGetProductAndCategory with a return type of ObjectResult<uspGetProductAndCategory_Result>. But this complex type is about only 1st result set.

I have read many topics on "How to Call Multiple Result Set SP in EF 6" but didn't get any solution yet. After changing the function import and other elements through XML editor as describe here, how I will call the function uspGetProductAndCategory_Result which is already returning ObjectResult<uspGetProductAndCategory_Result>

Here's all the screen shot

After importing the stored procedure into the ContextEntityClass:

ContextEntityClass

DbContext.edmx after changing the function import

enter image description here

1
  • EF doesn't support multiple result sets from a stored procedure. Either change your procedure to return a single result set, or if you cannot do this, then you must use straight, raw ADO.NET to handle this stored procedure and its returned data
    – marc_s
    Commented Oct 18, 2015 at 7:04

1 Answer 1

0

A little bit advice. Do not use multiply result set in EF. That's it. May be I am so rude. But I spent a lot of time for it. And use simply another approach for SP calling. Not EF. I don't want to ad these approaches you can easily find them in internet.

EF goes on the way as 'code first' approach and SPs are not fit to this conception.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.