views:

341

answers:

1

Example:

Client object has a collection of Action objects which records a history of actions performed against the client. Action is abstract and has several subclasses e.g. SystemAction, CorrespondenceAction etc.

I have a client search screen which has many optional search criteria, so using the criteria API is the obvious choice. Some of the search criteria relate to properties on the Action subclasses. E.g. Addressee on CorrespondenceAction.

Is it possible to use NHibernate ICriteria API to query on properties of the event subclasses? What mechanism do I use (detached sub queries perhaps?)

+1  A: 

Yes. Create DetachedCriteria for each search criteria that the user can specify and then add them to your CreateCriteria call.

Nigel