C# Класс 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.
Наследование: System.Linq.Expressions.ExpressionVisitor
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
HandleConditionalExpression ( Expression original, ConditionalExpression ifElse ) : Expression

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

Описание методов

FixStringMethodsVisitor() публичный Метод

Constructs an instance.
public FixStringMethodsVisitor ( ) : System.Collections.Generic
Результат System.Collections.Generic

Visit() публичный Метод

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.
Результат System.Linq.Expressions.Expression