public static ICriterion ProcessIsInCollection(MethodCallExpression methodCallExpression)
        {
            ExpressionProcessor.ProjectionInfo projection = ExpressionProcessor.FindMemberProjection(methodCallExpression.Arguments[0]);
            ICollection values = (ICollection)ExpressionProcessor.FindValue(methodCallExpression.Arguments[1]);

            return(projection.Create <ICriterion>(s => Restrictions.In(s, values), p => Restrictions.In(p, values)));
        }
        public static ICriterion ProcessIsLikeMatchMode(MethodCallExpression methodCallExpression)
        {
            ExpressionProcessor.ProjectionInfo projection = ExpressionProcessor.FindMemberProjection(methodCallExpression.Arguments[0]);
            string    value     = (string)ExpressionProcessor.FindValue(methodCallExpression.Arguments[1]);
            MatchMode matchMode = (MatchMode)ExpressionProcessor.FindValue(methodCallExpression.Arguments[2]);

            return(projection.Create <ICriterion>(s => Restrictions.Like(s, value, matchMode), p => Restrictions.Like(p, value, matchMode)));
        }
        public static ICriterion ProcessIsBetween(MethodCallExpression methodCallExpression)
        {
            MethodCallExpression betweenFunction = (MethodCallExpression)methodCallExpression.Object;

            ExpressionProcessor.ProjectionInfo projection = ExpressionProcessor.FindMemberProjection(betweenFunction.Arguments[0]);
            object lo = ExpressionProcessor.FindValue(betweenFunction.Arguments[1]);
            object hi = ExpressionProcessor.FindValue(methodCallExpression.Arguments[0]);

            return(projection.Create <ICriterion>(s => Restrictions.Between(s, lo, hi), p => Restrictions.Between(p, lo, hi)));
        }
Esempio n. 4
0
            public AbstractCriterion And(object hi)
            {
                AbstractCriterion criterion = projection.Create <AbstractCriterion>(s => Restrictions.Between(s, lo, hi), p => Restrictions.Between(p, lo, hi));

                if (isNot)
                {
                    return(Restrictions.Not(criterion));
                }

                return(criterion);
            }
Esempio n. 5
0
 public TReturn And(object hi)
 {
     return(Add(projection.Create <ICriterion>(s => Restrictions.Between(s, lo, hi), p => Restrictions.Between(p, lo, hi))));
 }
Esempio n. 6
0
 /// <summary>
 /// Apply an "in" constraint to the named property
 /// </summary>
 public TReturn IsIn(ICollection values)
 {
     return(Add(projection.Create <ICriterion>(s => Restrictions.In(s, values), p => Restrictions.In(p, values))));
 }
Esempio n. 7
0
 /// <summary>
 /// Apply an "in" constraint to the named property
 /// </summary>
 public AbstractCriterion IsIn(ICollection values)
 {
     return(Process(projection.Create <AbstractCriterion>(s => Restrictions.In(s, values), p => Restrictions.In(p, values))));
 }