istatelesssession

NHibernate iStatelessSession returns duplicate parent instances on eager fetch

浪子不回头ぞ 提交于 2020-01-04 03:25:31
问题 I'm trying to get a root entity and eager fetch it's child entities. But because I'm using the IStatelessSession of NHibernate, it returns duplicates of the root entity for each child. Using an ISession, it would be solved with .TransformUsing(new DistinctRootEntityResultTransformer()) But for an IStatelessSession it's not. Basically it's about the code below, where there's just one instance of Parent, holding 3 Childs. var result = session.QueryOver<Parent>() .Fetch(i => i.Childs).Eager();