var session = serviceFactory.GetSessionFromConnectionString("MyDynamicsInstance");
// Find a contact by email address.
var contact = await Contact.LoadSingleAsync(session,
(query, exp) =>
{
query.FilterODataExpression filterExpression = (exp.email == "example@example.com").Select(;
ODataExpression[] selectExpression = new ODataExpression[] { exp.firstname, exp.lastname };
query.Filter(filterExpression).Select(selectExpression);
}
);
// Returned objects have strongly-type fields where defined.
Console.WriteLine($"First name: {contact.firstname}, Last name: {contact.lastname}"); |