FetchXMLBuilder icon indicating copy to clipboard operation
FetchXMLBuilder copied to clipboard

FluentAPI for CRM's FetchXML

Open kiquenet opened this issue 9 years ago • 1 comments

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.

kiquenet avatar Oct 19 '16 07:10 kiquenet

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 :)

rappen avatar Oct 21 '16 14:10 rappen

We now have it (after next release) a Fluent generated C# code! See #828

rappen avatar Feb 06 '23 20:02 rappen