I am writing a query where a single Entity should prefetch 2 related Entities (C#). I prefer to keep my queries simple (no QuerySpec, no Prefetch) so followed the guidelines as set out here: https://www.llblgen.com/Documentation/5.8/LLBLGen%20Pro%20RTF/Using%20the%20generated%20code/Linq/gencode_linq_prefetchpaths.htm#multiple-nodes-at-the-same-level-1
The option to chain .With() statements doesn't seem to work. Consider this:
public IQueryable<CommandEntity> Build(Guid tenantGuid, Guid commandGuid)
{
var db = new LinqMetaData(dataAccessAdapter);
return (from command in db.Command
where command.TenantGuid == tenantGuid && command.Guid == commandGuid
select command)
.With(cm => cm.Tenant) // is null
.With(cm2 => cm2.CommandScheduler); // is found
}
And if I swap the With statements:
public IQueryable<CommandEntity> Build(Guid tenantGuid, Guid commandGuid)
{
var db = new LinqMetaData(dataAccessAdapter);
return (from command in db.Command
where command.TenantGuid == tenantGuid && command.Guid == commandGuid
select command)
.With(cm2 => cm2.CommandScheduler) // is null
.With(cm => cm.Tenant); // is found
}
At first I thought it might not work because the PK for Tenant is used in the where clause, but as demonstrated the problem seems to be that other .With statements other than the last are ignored. I also used different variable names (cm, cm2) because I thought that might cause a clash, but to no avail.
What could be the issue here?