We're updating the issue view to help you get more done. 

Add a filtering mechanism to expression node types registered by names

Description

The MethodCallExpressionNodeTypeRegistry has been replaced by an interface (INodeTypeProvider) with several implementations. One of them, the MethodNameBasedNodeTypeRegistry, provides support for registering expression node parsers by name (rather than MethodInfo). Since the method name is usually not enough to distinguish query operators, a registration also contains a filter predicate that determines whether a node parser is suitable for parsing a specific query operator method.

Consider the following example:

This code defines that the given MyContainsExpressionNode is registered for the Contains query operators defined by the Queryable and Enumerable classes, and, in addition, for all methods called "Contains" (with the right argument count) declared by classes implementing IEnumerable. Only "string" is exempt, since string.Contains is usually not desired to be seen as a query operator.

(This code is how the ContainsExpressionNode class is currently defined in re-linq.)

To use such a custom expression node parser, create a MethodNameBasedNodeTypeRegistry when creating the QueryParser in your LINQ provider.

Status

Assignee

Fabian Schmied

Reporter

Fabian Schmied

Labels

Time tracking

3h

Components

Fix versions

Priority

Normal
Configure