7

I am using Code First in a project. The project is half done. I need to call a stored procedure to return multiple results (3 selects). My research tells me that it is not supported in Code First. What options do I have? Changing the project to use Model first?

Frank
  • 237
  • 4
  • 13

2 Answers2

7

Roman from MSFT answered my question. He blogged about it here: http://romiller.com/2012/08/15/code-first-stored-procedures-with-multiple-results/

I am sure a lot of people are having the same problem. Hope this can help.

Frank
  • 237
  • 4
  • 13
1

Can you break the sproc into 3? I think you would have a problem returning multiple entities from one query. Otherwise, would this work for you? https://stackoverflow.com/a/4845591/1572123

Community
  • 1
  • 1
  • Thank you for the comment. It would take 3 trips back to database. Performanc would take a big hit. – Frank Aug 14 '12 at 22:51
  • Good point. Since I obviously can't help you, I'll close by suggesting a _terrible_ hack whereby you create a composite POCO that contains 3 `IList` of types that correspond to each of the 3 result sets. You could then use `.Include()` for each when retrieving the parent to return all 3 lists at once. Shoddy, I know. ;) Good luck, Frank. – James Fernandes Aug 15 '12 at 22:25