Retrieve a list of entites from CRM 2011, each with all of their related entities

本秂侑毒 提交于 2019-12-11 00:26:45

问题


I have two entities in CRM 2011 - EmailMatchingRule and EmailMatchingRuleField, in a standard parent-child relationship. What I want to retrieve is a set of all of the rules, each with all of its fields pre-fetched as related entities.

Is this even possible? I can get a flattened list using the QueryExpression AddLinkEntity functionality, but that's not really what I'm after.
Using early bound entities and Linq, I can only figure out how to get a list of each, but without the related items.

Any thoughts ?

TIA


回答1:


Your linq statement needs to use an "Include".

from rule in EmailMatchingRule.Include("EmailMatchingRuleField")
select rule

The collection of rules you'll get back will have all the matching rules now already eagerly loaded.



来源:https://stackoverflow.com/questions/6139455/retrieve-a-list-of-entites-from-crm-2011-each-with-all-of-their-related-entitie

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!