Within EF4, it's pretty easy to map a s开发者_运维问答tored procedure into an entity. I create the stored proc, Add it to the model, then do a Function Import and specify the parent entity.
Now, the rub comes in that I want my stored proc to do "eager loading" of the children entities.
In effect, I have a table Parents and a table Children, with a one to many relationship between them. I'd like my stored proc to return all Parents that match a criteria and all Children of those parents, distributed into the entity model as one would imagine.
How is this accomplished?
Assuming you mean that you want your stored procedure to return multiple result sets, you may want to have a look at this question.
The basic gist is that this isn't supported as an out-of-the-box feature, but there's an extension to EF that evidently makes this possible.
精彩评论