开发者

Map a stored procedure to an Entity object and its child objects

开发者 https://www.devze.com 2023-01-07 21:19 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消