When sub-classing with the use of discriminators, a selection on the
subbed class results in the query generating a where clause including
the discriminator.
For example:
Give the classes:
Photo
FamilyPhoto
HolidayPhoto
If you select:
var result = session.QueryOver<HolidayPhoto>().List;
You would get something along the lines of:
select ... from Photo where PhotoType = 2
That works fine.
-------------------------
When you have an object with a collection of a subbed class.
Say:
public class Family
{
...
public virtual List<FamilyPhoto> Photos {get;set;}
}
Adding photos generate the correct PhotoType on insert, but when
querying for Family, and eager/lazy loading the Photos, the
discriminator value is never included.
var result = session.QueryOver<Family>().Fetch(x =>
x.Photos).Eager.List;
It generates something like:
SELECT this_.Id as Id0_1_,
this_.Name as Name0_1_,
photos2_.EntityId as EntityId3_,
photos2_.Id as Id3_,
photos2_.Id as Id1_0_,
photos2_.FileName as FileName1_0_,
photos2_.EntityId as EntityId1_0_
FROM Family this_
left outer join Photo photos2_
on this_.Id = photos2_.EntityId
------
I would expect that the discriminator is included in the where clause
but it's not. Is this a bug?
--
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.