views:

63

answers:

1

Within EF4, it's pretty easy to map a stored 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?

A: 

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.

Adam Robinson