C# Class Pathoschild.WebApi.NhibernateOdata.Internal.FixStringMethodsVisitor

Intercepts queries before they're parsed by NHibernate to rewrite unsupported lambdas for string.Contains, string.StartsWith(string) and string.EndsWith(string).
The expression tree generated by the ODataQueryOptions.ApplyTo method looks like the following sample. .Lambda #Lambda1<System.Func`2[Pathoschild.WebApi.NhibernateOdata.Tests.Models.Parent,System.Boolean]>(Pathoschild.WebApi.NhibernateOdata.Tests.Models.Parent $$it) { (.If ( $$it.Name == null | .Constant<System.Web.Http.OData.Query.Expressions.LinqParameterContainer+TypedLinqParameterContainer`1[System.String]>(System.Web.Http.OData.Query.Expressions.LinqParameterContainer+TypedLinqParameterContainer`1[System.String]).TypedProperty == null ) { null } .Else { (System.Nullable`1[System.Boolean]).Call ($$it.Name).Contains(.Constant<System.Web.Http.OData.Query.Expressions.LinqParameterContainer+TypedLinqParameterContainer`1[System.String]>(System.Web.Http.OData.Query.Expressions.LinqParameterContainer+TypedLinqParameterContainer`1[System.String]).TypedProperty) } == (System.Nullable`1[System.Boolean]).Constant<System.Web.Http.OData.Query.Expressions.LinqParameterContainer+TypedLinqParameterContainer`1[System.Boolean]>(System.Web.Http.OData.Query.Expressions.LinqParameterContainer+TypedLinqParameterContainer`1[System.Boolean]).TypedProperty) == .Constant<System.Nullable`1[System.Boolean]>(True) } The actual System.Web.Http.OData parser DOES NOT support the "replace" string method, so we can't make it go through NHibernate.
Inheritance: System.Linq.Expressions.ExpressionVisitor
Afficher le fichier Open project: Pathoschild/webapi.nhibernate-odata Class Usage Examples

Méthodes publiques

Méthode Description
FixStringMethodsVisitor ( ) : System.Collections.Generic

Constructs an instance.

Visit ( Expression node ) : Expression

Dispatches the expression to one of the more specialized visit methods in this class.

Private Methods

Méthode Description
HandleConditionalExpression ( Expression original, ConditionalExpression ifElse ) : Expression

Handles the conditional expression (equivalent to .If {} .Else {} in the sample expression tree in the FixStringMethodsVisitor remarks).

Method Details

FixStringMethodsVisitor() public méthode

Constructs an instance.
public FixStringMethodsVisitor ( ) : System.Collections.Generic
Résultat System.Collections.Generic

Visit() public méthode

Dispatches the expression to one of the more specialized visit methods in this class.
public Visit ( Expression node ) : Expression
node System.Linq.Expressions.Expression The expression to visit.
Résultat System.Linq.Expressions.Expression