LLBLGen Pro. Version: 2.6 Final (October 6th, 2008 )
Runtime Issue
This is my table structure
TableA --- 1:n --- TableB ---- n:1 ---- TableC
I am trying to take advantage of the m:n relationships that llblgen detects.
When I use this prefetch path, I get all my related entites in Table C
IPrefetchPath2 pathA = new PrefetchPath2(EntityType.TableAEntity);
IPrefetchPathElement2 pathB = path.Add(TableAEntity.PrefetchPathTableB);
IPrefetchPathElement2 pathC = pathB.SubPath.Add(TableBEntity.PrefetchPathTableC);
When I use this prefetch path, I only get the first related entity in Table C
IPrefetchPath2 pathA = new PrefetchPath2(EntityType.TableAEntity);
IPrefetchPathElement2 pathC = path.Add(TableAEntity.PrefetchPathTableCViaTableB);
Why does using the m:n relationship only give me one result?
Edit: I am doing some more testing, it appears that this is an issue from calling IQueryable.First. When you call First (or Take(1)) it will be applied to the main query, as well as all the subqueries. Is this is expected behavior?
var q = from a in metaData.TableA
select a;
q = q.WithPath(pathA);
q.First(); //returns first A entity, as well as first C entity