What is the difference / benefit between ICriteria and ICriterion in nHibernate?

A bit of a new question when I start with nHibernate.

What is the difference between the classes NHibernate.Criterion.ICriterion and NHibernate.ICriteria and which I should use for simple filtering of types << 22>?

+4
source share
1 answer

ICriteria is used to represent the request. You can add ICriterions to this ICriteria to express filters.

For instance:

 ICriteria crit = session.CreateCriteria (typeof(Person)); crit.Add (NHibernate.Criterion.Expression.Eq("Name", "somename")); 

Or as stated in the documentation:

ICriterion: an object-oriented representation of the query criteria that can be used as a constraint in the ICriteria Request

ICriteria: A simplified API for retrieving objects by compiling NHibernate.Criterion.Expression objects.

+13
source

All Articles