rappen / FetchXMLBuilder

FetchXML Builder for XrmToolBox and Microsoft Dynamics 365 / CRM
https://fetchxmlbuilder.com/
GNU General Public License v3.0
135 stars 56 forks source link

Generate DLaB's type of QueryExpressionFactory #822

Open rappen opened 1 year ago

rappen commented 1 year ago

An idea by @daryllabar.

What would it take for me to be able to add my own custom QueryExpression Helpers as an option?

Would YOU use it? Thumbs up if so!

He sent me an example:

var qe = QueryExpressionFactory.Create<Account>(a => new {
        a.Name,
        a.Address1_City,
        a.PrimaryContactId,
        a.Telephone1,
        a.AccountId
    },
    Account.Fields.StateCode, query_statecode,
    new ConditionExpression(Account.Fields.Address1_Line1, ConditionOperator.Null));

var par = qe.AddLink<Contact>(c => new {
        c.EmailAddress1,
        c.FirstName,
        c.LastName
    },
    Account.Fields.PrimaryContactId, Contact.Fields.Id);
par.AddColumns<Contact>();
par.WhereEqual(
    new ConditionExpression(Contact.Fields.FullName, ConditionOperator.NotEqual, query_0_par_fullname)
    new ConditionExpression(Contact.Fields.Address1_Country, ConditionOperator.Like, par_address1_country));

var R = par.AddLink<rapp_Rocket>(c => new {
        c.rapp_Number
    },Contact.Fields.ContactId, rapp_Rocket.Fields.rapp_ContactId);
R.WhereEqual(new ConditionExpression(rapp_Rocket.Fields.rapp_Nane, ConditionOperator.NotNull)

qe.AddOrder(Account.Fields.Name, OrderType.Ascending);

You can get the source for DLaB's code here: https://www.nuget.org/packages/DLaB.Xrm.Source