Esempio n. 1
0
        /// <summary>
        /// Parses the passed-in Expression into exclusive (WHERE x=y) constraint.
        /// </summary>
        /// <param name="expression">The expression.</param>
        /// <returns></returns>
        public static Constraint ParseConstraint(this LambdaExpression expression)
        {
            QueryVisitor q           = new QueryVisitor();
            var          constraints = q.GetConstraints(expression);

            Constraint result = constraints.Count > 0 ? constraints[0] : new Constraint();

            //ExpressionParser parser = new ExpressionParser();
            //List<Constraint> constraints = parser.ProcessExpression(expression);

            //if (constraints.Count > 0)
            //    result = constraints[0];

            return(result);
        }
Esempio n. 2
0
        /// <summary>
        /// Parses the passed-in Expression into exclusive (WHERE x=y) constraints.
        /// </summary>
        /// <param name="exp">The exp.</param>
        /// <returns></returns>
        public static IList <Constraint> ParseConstraints(this Expression exp)
        {
            QueryVisitor q = new QueryVisitor();

            return(q.GetConstraints(exp));
        }