Exemplo n.º 1
0
        public static SqlExpression Translate(Expression expression)
        {
            var ast = new Stack<SqlExpression>();
            new WhereParser(ast).Visit(expression);

            if (ast.Count == 0)
                return null;

            var sqlExpression = ast.Pop();
            sqlExpression = new ImplicitBooleanPredicatePropagator().Visit(sqlExpression);
            sqlExpression = new NullCheckPropagator().Visit(sqlExpression);

            return sqlExpression;
        }
Exemplo n.º 2
0
        public static SqlExpression Translate(Expression expression)
        {
            var ast = new Stack <SqlExpression>();

            new WhereParser(ast).Visit(expression);

            if (ast.Count == 0)
            {
                return(null);
            }

            var sqlExpression = ast.Pop();

            sqlExpression = new ImplicitBooleanPredicatePropagator().Visit(sqlExpression);
            sqlExpression = new NullCheckPropagator().Visit(sqlExpression);

            return(sqlExpression);
        }