示例#1
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="QueryParser" /> class, using default parameters for parsing.
        ///     The <see cref="Structure.ExpressionTreeParser.NodeTypeProvider" /> used has all relevant methods of the
        ///     <see cref="Queryable" /> class
        ///     automatically registered, and the <see cref="Structure.ExpressionTreeParser.Processor" /> comprises partial
        ///     evaluation, and default
        ///     expression transformations. See <see cref="Structure.ExpressionTreeParser.CreateDefaultNodeTypeProvider" />,
        ///     <see cref="Structure.ExpressionTreeParser.CreateDefaultProcessor" />, and
        ///     <see cref="ExpressionTransformerRegistry.CreateDefault" />
        ///     for details.
        /// </summary>
        public static QueryParser CreateDefault()
        {
            var transformerRegistry         = ExpressionTransformerRegistry.CreateDefault();
            var evaluatableExpressionFilter = new NullEvaluatableExpressionFilter();
            var expressionTreeParser        = new ExpressionTreeParser(
                ExpressionTreeParser.CreateDefaultNodeTypeProvider(),
                ExpressionTreeParser.CreateDefaultProcessor(transformerRegistry, evaluatableExpressionFilter));

            return(new QueryParser(expressionTreeParser));
        }
示例#2
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="QueryParser" /> class, using the given
 ///     <paramref name="expressionTreeParser" /> to
 ///     convert <see cref="Expression" /> instances into <see cref="IExpressionNode" />s. Use this constructor if you wish
 ///     to customize the
 ///     parser. To use a default parser (with the possibility to register custom node types), use the
 ///     <see cref="CreateDefault" /> method.
 /// </summary>
 /// <param name="expressionTreeParser">The expression tree parser.</param>
 public QueryParser(ExpressionTreeParser expressionTreeParser)
 {
     ArgumentUtility.CheckNotNull("expressionTreeParser", expressionTreeParser);
     ExpressionTreeParser = expressionTreeParser;
 }