简体   繁体   中英

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM