Example #1
0
        public static ICriteria WhereCaseInsensitiveContains <T>(this ICriteria criteria, Expression <Func <T, object> > expression, string value)
        {
            var criterion = Restrictions.InsensitiveLike(expression.ToPropertyName(), "%" + value + "%");

            return(criteria.Add(criterion));
        }
Example #2
0
        public static ICriteria WhereNotIn <T>(this ICriteria criteria, Expression <Func <T, object> > expression, DetachedCriteria subquery)
        {
            var propertyName = expression.ToPropertyName();

            return(criteria.Add(Subqueries.PropertyNotIn(propertyName, subquery)));
        }
Example #3
0
        public static ICriteria WhereOnOrAfter <T>(this ICriteria criteria, Expression <Func <T, object> > expression, object value)
        {
            var propertyName = expression.ToPropertyName();

            return(criteria.Add(Expression.Ge(propertyName, value)));
        }
Example #4
0
        public static ICriteria WhereIsNull <T>(this ICriteria criteria, Expression <Func <T, object> > expression)
        {
            var propertyName = expression.ToPropertyName();

            return(criteria.Add(Restrictions.IsNull(propertyName)));
        }
Example #5
0
        public static ICriteria WhereEqualTo <T, U>(this ICriteria criteria, Expression <Func <T, U> > expression, U value)
        {
            var propertyName = expression.ToPropertyName();

            return(criteria.Add(Expression.Eq(propertyName, value)));
        }
Example #6
0
        public static DetachedCriteria SetProjection <T>(this DetachedCriteria criteria, Expression <Func <T, object> > expression)
        {
            var propertyName = expression.ToPropertyName();

            return(criteria.SetProjection(Projections.Property(propertyName)));
        }