Hi all
I'm evaluating LLBLGen and stumbled over what looks like a bug with this simple query that contains a prefetch path. I simplified it a little in order to give you an easy repro.
Bascially, we have a 1:n relationship between a JobFunctionGroup and its contained job functions. What I did is for a set of functions, i would like to prefetch the group and also populate the group's JobFunctions collection immediately.
This hits the DB with 3 queries that eventually resolve all the job functions. However, the JobFunctions collection of the group contains the first element twice:
LinqMetaData md = new LinqMetaData(adapter);
//get all functions in the group "binning"
var functions = from f in md.JobFunction where f.JobFunctionGroup.Description.Contains("Bin") select f;
//for each function, get the group and also all the group's functions
functions = functions.WithPath(p => p.Prefetch<JobFunctionGroupEntity>(jf => jf.JobFunctionGroup)
.SubPath(p2 => p2.Prefetch(g => g.JobFunctions)));
//get a sample group
var group = functions.First().JobFunctionGroup;
//group.JobFunctions contains the first item TWICE (probably because we resolved the group through that item
var result = group.JobFunctions.OrderBy(f => f.JobFunctionNbr);