简体   繁体   中英

FetchXML in .NET Core - CRM Web API

I'm learning how to use CRM Web API with .NET Core to work with entities and I found this very useful library . There is an option to retrieve record data using FetchXML .

string fetchXml = "<fetch mapping='logical'><entity name='account'><attribute name='accountid'/><attribute name='name'/></entity></fetch>";
var fetchResults = await api.GetList("accounts", QueryOptions: new CRMGetListOptions() { FetchXml = fetchXml });

Is there any option how to compose more easily and elegantly the fetchXML , for example by using QueryExpression ( Microsoft.CrmSdk.CoreAssemblies ) or something similar?

  1. Design the Advanced find query & download the fetchxml
  2. Develop fetchxml queries using XrmToolBox FetchXML builder

You can use QueryExpressionToFetchXmlRequest to convert the QueryExpression into FetchXml.

Read more

I have found Mike Ochs's FetchXmlWrapper helpful in certain projects.

More info: https://www.cobalt.net/2014/06/25/performance-improvements-using-fetch-xml-wrapper/

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