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

Intercepts queries before they're parsed by NHibernate to rewrite null check for components which aren't necessary for NHibernate. NHibernate does not support checking for null on components which have 4 or more properties mapped. I don't know why really, but it crashes with a recognition error in the HQL.
The expression tree generated by the ODataQueryOptions.ApplyTo method looks like the following sample. .Call System.Linq.Queryable.Where( .Constant<NHibernate.Linq.NhQueryable`1[Pathoschild.WebApi.NhibernateOdata.Tests.Models.Parent]>(NHibernate.Linq.NhQueryable`1[Pathoschild.WebApi.NhibernateOdata.Tests.Models.Parent]), '(.Lambda #Lambda1<System.Func`2[Pathoschild.WebApi.NhibernateOdata.Tests.Models.Parent,System.Boolean]>)) .Lambda #Lambda1<System.Func`2[Pathoschild.WebApi.NhibernateOdata.Tests.Models.Parent,System.Boolean]>(Pathoschild.WebApi.NhibernateOdata.Tests.Models.Parent $$it) { (.If ($$it.Component == null) { null } .Else { (System.Nullable`1[System.Int32])($$it.Component).Two } == (System.Nullable`1[System.Int32]).Constant<System.Web.Http.OData.Query.Expressions.LinqParameterContainer+TypedLinqParameterContainer`1[System.Int32]>(System.Web.Http.OData.Query.Expressions.LinqParameterContainer+TypedLinqParameterContainer`1[System.Int32]).TypedProperty) == True }
Inheritance: System.Linq.Expressions.ExpressionVisitor
ファイルを表示 Open project: Pathoschild/webapi.nhibernate-odata

Public Methods

Method Description
Visit ( Expression node ) : Expression

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

Private Methods

Method 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

Visit() public method

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.
return System.Linq.Expressions.Expression