从CRM 2011中检索实体的列表,每个实体及其所有相关实体 [英] Retrieve a list of entites from CRM 2011, each with all of their related entities
问题描述
在CRM 2011中,我有两个实体-标准的父子关系中的EmailMatchingRule和EmailMatchingRuleField.我要检索的是一组所有规则,每个规则的所有字段都预先提取为相关实体.
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.
这甚至有可能吗?我可以使用QueryExpression AddLinkEntity功能获得扁平化列表,但这并不是我真正想要的.
使用早期绑定的实体和Linq,我只能弄清楚如何获取每个实体的列表,而没有相关的内容.
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.
有什么想法吗?
TIA
推荐答案
您的linq语句需要使用包含".
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.
这篇关于从CRM 2011中检索实体的列表,每个实体及其所有相关实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!