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

Add a way to transform MethodCallExpressions via a custom attribute applied to the method

Description

re-linq already provides a mechanism to transform subexpressions of a query's expression tree via implementations of IExpressionTransformer<T>. These need to be registered when the QueryParser (or actually the ExpressionTreeParser) is constructed.

It would be desirable to have this mechanism at one's disposal even when the LINQ provider's initialization code cannot be adapted. To enable this, add a custom attribute called MethodCallExpressionAttribute that takes the type of a transformer as an argument and add a predefined transformation that detects this attribute on methods and property get accessors.

This then enables a user to define how a method or property is to be represented within the QueryModel:

The transformer type passed to the MethodCallExpressionTransformerAttribute must have a public constructor. To support even more customization, including transformers without default constructors, users can also define their own attributes by implementing the AttributeEvaluatingExpressionTransformer.IMethodCallExpressionTransformerAttribute interface.

(Note that the SQL backend already has such a mechanism via the IMethodCallTransformerAttribute interface. Adding an equivalent feature to the front-end makes the extension point available to a wider range of users. The SQL backend feature is deprecated in favor of the new feature.)

Status

Assignee

Fabian Schmied

Reporter

Fabian Schmied

Labels

None

Time tracking

3h

Components

Fix versions

Priority

Normal
Configure