How to query NHibernate for specific type?
问题 I'm using Fluent NHibernate with DiscriminateSubClassesOnColumn() to support subclassing. The column used to discriminate between subclasses is not mapped to an actual property on the entity. How do I create a query which returns only entities of a given type? Here's my try, where propertyName is the name of my discriminating column and value is the type name: return _db.CreateCriteria<T>() .Add(Restrictions.Eq(propertyName, value)) .List<T>(); However this gives me the error "could not