Hi,
I think, I understand DistinctRootEntityResultTransformer and I know
its implementation.
Let me summarize:
Repository<DbProduct>.FindAll(
DetachedCriteria.For<DbProduct>().
SetFetchMode("Categories", FetchMode.Eager));
In above case I can get multiple DbProduct when it contains more than
one Category.
I can easly fix it:
Repository<DbProduct>.FindAll(
DetachedCriteria.For<DbProduct>().
SetFetchMode("Categories", FetchMode.Eager)).
SetResultTransformer(new
DistinctRootEntityResultTransformer()));
So far, so good.
Problem start when I using:
Repository<DbProduct>.FindAll(
DetachedCriteria.For<DbProduct>().
SetFetchMode("Categories", FetchMode.Eager)).
SetFetchMode("Attributes", FetchMode.Eager).
SetResultTransformer(new
DistinctRootEntityResultTransformer()));
In the result all DbProduct are distinct (as expected), but I have
multiple duplicates in Categories (as many as elements in Attributes).
When you focus on sql result this may occur even obvious.
Categories and Attributes are collections mapped on IList (I know that
ISet can help, but I can't use it due to other reasons)
DistinctRootEntityResultTransformer removes duplicates only on Root
level.
Do you know any general solution to fix this error? Something like
DistinctEntityResultTransformer
Bartosz Pierzchlewicz
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---