What’s the difference/advantages between ICriteria and ICriterion in nHibernate?

An ICriteria is used to represent a query. 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 the documentation states:

ICriterion: An object oriented representation of a query criterion that may be used as a constraint in an ICriteria query

ICriteria: a simplified API for retrieving entities by composing NHibernate.Criterion.Expression objects.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s