I'm looking to use ICriteria to retrieve based on multiple classes of
the same base class.
Lets say we have a Mammal abstract class which is implemented by Dog,
Cat and Human classes with discriminators 1, 2, 3.
return Session.CreateCriteria(typeof(Mammal))
.Add(Expression.Eq("Hair.Color", Brown))
.List<Mammal>();
I want to modify this query to only return Dogs and Cats. The
following is the only way I can think of:
return Session.CreateCriteria(typeof(Mammal))
.Add(Expression.Eq("Hair.Color", Brown))
.Add(Expression.Sql("Discriminator IN (1, 2)"))
.List<Mammal>();
I'd rather not use a multiquery since it would be less efficient and
the properties that are being restricted exist in the base class.
Thanks,
Scott
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---