The NodeTypeRegistry properties on QueryParser and ExpressionTreeParser have been replaced by NodeTypeProvider properties

Description

This change has been made in the course of larger refactorings.

If you use these properties to customize a default QueryParser (created via QueryParser.CreateDefault), you can cast the result of the NodeTypeProvider property to CompoundNodeTypeProvider and manipulate its InnerProviders property (adding new providers/registries or removing existing ones).

It is recommended, however, to create customized QueryParsers as follows:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 private static IQueryParser CreateQueryParser () { var customNodeTypeRegistry = new MethodInfoBasedNodeTypeRegistry(); // Register custom node parsers here: // customNodeTypeRegistry.Register (MyExpressionNode.SupportedMethods, typeof (MyExpressionNode)); // Alternatively, use the CreateFromTypes factory method. // Use MethodNameBasedNodeTypeRegistry to register parsers by query operator name instead of MethodInfo. var nodeTypeProvider = ExpressionTreeParser.CreateDefaultNodeTypeProvider (); nodeTypeProvider.InnerProviders.Add (customNodeTypeRegistry); var transformerRegistry = ExpressionTransformerRegistry.CreateDefault (); // Register custom expression transformers here: // transformerRegistry.Register (new MyExpressionTransformer()); var processor = ExpressionTreeParser.CreateDefaultProcessor (transformerRegistry); // Add custom processors here: // processor.InnerProcessors.Add (new MyExpressionTreeProcessor()); var expressionTreeParser = new ExpressionTreeParser (nodeTypeProvider, processor); var queryParser = new QueryParser (expressionTreeParser); return queryParser; }

That way, the NodeTypeProvider property needn't be used for customization.

Status

Assignee

Fabian Schmied

Reporter

Fabian Schmied

Labels

Time tracking

0m

Components

Fix versions

Priority

Normal