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 Ad开发者_如何学GodLinkEntity 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.
精彩评论