【发布时间】:2010-11-15 15:43:10
【问题描述】:
我一直避免使用 fetchxml,因为我不确定在调用 crmService.Fetch(fetchXml) 后处理结果数据的最佳方式。在几种情况下,我使用了带有 LINQ 的 XDocument 从该数据结构中检索数据,例如:
XDocument resultset = XDocument.Parse(_service.Fetch(fetchXml));
if (resultset.Root == null || !resultset.Root.Elements("result").Any())
{
return;
}
foreach (var displayItem in resultset.Root.Elements("result").Select(item => item.Element(displayAttributeName)).Distinct())
{
if (displayItem!= null && displayItem.Value != null)
{
dropDownList.Items.Add(displayItem.Value);
}
}
处理 fetchxml 结果数据的最佳方法是什么,以便它可以轻松使用。将这些记录传递到 ASP.NET 数据网格等应用程序将非常有用。
【问题讨论】:
标签: xml data-structures dynamics-crm data-manipulation fetchxml