ICriteriaQuery query = session.CreateCriteria(typeof(Product)); query.Add(Restrictions.Like("Name", "%widget%")); query.AddUsedTypedValues(new object[] { "%widget%" });
ICriteriaQuery query = session.CreateCriteria(typeof(Order)); query.Add(Restrictions.Between("OrderDate", startDate, endDate)); query.AddUsedTypedValues(new object[] { startDate, endDate });This example creates a criteria query to find all orders that were placed between two dates. The AddUsedTypedValues method is used to add the start date and end date as parameters to the query. Package/Library: NHibernate.