FetchXMLBuilder
FetchXMLBuilder copied to clipboard
FluentAPI for CRM's FetchXML
For Fetch XML, xml construction by concatenating strings together, can be a real pain
IMHO, is good a FluentAPI for CRM's FetchXML Maybe https://github.com/tofi9/MSCRM-FetchXml
IOrganizationService organisationService = null; // CreateCrmService();
// construct FetchXml using fluent-api
FetchQuery query = new FetchQuery("lead")
.Filter(f => f.Gt("budgetamount", 5000))
.Attributes("fullname", "companyname", "budgetamount");
// execution requires only one single line
IReadOnlyList<Entity> result = query.RetrieveMultiple(organisationService);
foreach(Entity entity in result)
{
Console.WriteLine($"{entity["fullname"]}: {entity["budgetamount"]}");
}
Maybe integration in Fetch XML Builder or generate C# Code similar.
Could be nice for those using that FluentAPI. I have no idea what the current audience for that is though. But I am open to pull requests improving FXB :)
We now have it (after next release) a Fluent generated C# code! See #828