0

I'm using QueryOver and eagerly loading a filtered collection, similar to the following:

Part partAlias=null;
Session.QueryOver<Car>().JoinQueryOver(x=>x.Parts,()=>partAlias)
.WhereRestrictionOn(()=>partAlias.Id).IsIn(partIds)
.List<Car>();

The problem is that when I reference the resulting collection (.Parts) it gets fetched from the database and overwrites what I had before. I'm using Fluent Nhibernate for config.

Gerard
  • 2,461
  • 2
  • 26
  • 34
Alex
  • 9,250
  • 11
  • 70
  • 81

1 Answers1

0

Ok, I ended up getting everything to work. There were a few different issues. One was including other relationships that created a Cartesian product that caused collections to multiply. Another problem, which is more specific to my question here I solved by adding the join type as JoinType.LeftOuterJoin. I found the advice on this thread. The default is to use an inner join and that just doesn't work. The join MUST be a left outer join.

Community
  • 1
  • 1
Alex
  • 9,250
  • 11
  • 70
  • 81