I have a scenario where there is need to retrieve data from multiple tables in Dataverse, below is a sample query (there are 7 tables involved in Join, for simplicity i have included only 3).
var query = from location in organizationContext.LocationData
join address in organizationContext.Address on location.LocationId equals address.locationAddressRelation.Id
into addressGrp from addressJ in addressGrp.DefaultIfEmpty() //Commenting this and
join contact in organizationContext.Contact on location.LocationId equals contact.locationContactRelation.Id
into contactGrp from contactJ in contactGrp.DefaultIfEmpty() // and commenting this makes the query work
select new {location.Id, address.Id, contact.Id};
Executing the above query results in the below error,
System.AggregateException: 'One or more errors occurred. (The method 'Join' cannot follow the method 'SelectMany' or is not supported. Try writing the query in terms of supported methods or call the 'AsEnumerable' or 'ToList' method before calling unsupported methods.)'
This could be a limitation of the Linq to CRM provider, i want to know any alternatives to the above requirement.
Thanks.