locked
EF and Store Procedure returning multiple result sets of complex types RRS feed

  • Question

  • Hello,

    I have a stored procedure that returns 7-9 results sets and all of them are complex types.

    I have mapped stored procedures to return a complex type.  I know how to get a stored procedure to return multiple resluts sets and translate them into entiity objects.  Unfortunatly I need to know how to get results sets from the stored procedure when they are complex types. 

    The project uses C#, EF4, Database first, and MVC.

    Thank you for your direction.

     

     

    • Moved by Paul Zhou Friday, November 11, 2011 7:46 AM move for better support (From:.NET Platform Architecture Development Discussions)
    Thursday, November 10, 2011 8:11 PM

Answers

All replies

  • Move to EF forum to get better support.

    Have a nice day.


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, November 11, 2011 7:45 AM
  • Hi Iceonovich;

    Currently Entity Framework 4 out of the box does not support stored procedurs that return multiple result sets. Microsoft has an extension to EF which will allow you to do this, please see this link ADO.NET Entity Framework Extensions.

    Also please see this posting, ADO.NET Entity framework advanced scenarios: Working with stored procedures that return multiple resultsets.

     


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    • Proposed as answer by Holger Kreissl Friday, November 11, 2011 2:53 PM
    • Marked as answer by Iceonovich Monday, November 14, 2011 9:05 PM
    Friday, November 11, 2011 2:32 PM
  • On 11/10/2011 3:11 PM, Iceonovich wrote:
    > Hello,
    >
    > I have a stored procedure that returns 7-9 results sets and all of them
    > are complex types.
    >
    > I have mapped stored procedures to return a complex type. I know how to
    > get a stored procedure to return multiple resluts sets and translate
    > them into entiity objects. Unfortunatly I need to know how to get
    > results sets from the stored procedure when they are complex types.
    >
    > The project uses C#, EF4, Database first, and MVC.
    >
    > Thank you for your direction.
    >
     
    You can always use the backdoor, run the sproc, use a datareader with
    resultset.movenext, instantiate entities off the model, populate
    entities and return them.
     
     
    Friday, November 11, 2011 3:52 PM
  • Soto,

    I had skimmed these articles previously. Unfortunatly I had assumed that the Materialize was like Translate and required the object to be a part of the entity. 

     

    For anyone else figuring this out; the Materializer is a common point for you to map the Store Procedure return column to the value in the object.

     

    Monday, November 14, 2011 9:30 PM