Exemplo n.º 1
0
 public override NHibernate.Hql.Ast.HqlTreeNode BuildHql(System.Reflection.MethodInfo method, System.Linq.Expressions.Expression targetObject, System.Collections.ObjectModel.ReadOnlyCollection <System.Linq.Expressions.Expression> arguments, NHibernate.Hql.Ast.HqlTreeBuilder treeBuilder, NHibernate.Linq.Visitors.IHqlExpressionVisitor visitor)
 {
     //return treeBuilder.Constant(0);
     return(treeBuilder.Case(new HqlWhen[] {
         treeBuilder.When(
             treeBuilder.LessThan(visitor.Visit(arguments[0]).AsExpression(), visitor.Visit(arguments[1]).AsExpression()),
             treeBuilder.Constant(-1)),
         treeBuilder.When(
             treeBuilder.GreaterThan(visitor.Visit(arguments[0]).AsExpression(), visitor.Visit(arguments[1]).AsExpression()),
             treeBuilder.Constant(1))
     },
                             treeBuilder.Constant(0)));
 }
 public override NHibernate.Hql.Ast.HqlTreeNode BuildHql(MethodInfo method,
                                                         Expression targetObject,
                                                         ReadOnlyCollection <Expression> arguments,
                                                         NHibernate.Hql.Ast.HqlTreeBuilder treeBuilder,
                                                         NHibernate.Linq.Visitors.IHqlExpressionVisitor visitor)
 {
     // Below 'Class' method is not 'YourLinqExtensions.Class' extension method.
     // It is natively available on HqlTreeBuilder.
     return(treeBuilder.Dot(
                visitor.Visit(arguments[0]).AsExpression(),
                treeBuilder.Class()));
 }
 public override NHibernate.Hql.Ast.HqlTreeNode BuildHql(MethodInfo method,
                                                         Expression targetObject,
                                                         ReadOnlyCollection <Expression> arguments,
                                                         NHibernate.Hql.Ast.HqlTreeBuilder treeBuilder,
                                                         NHibernate.Linq.Visitors.IHqlExpressionVisitor visitor)
 {
     return(treeBuilder.Dot(
                // using NHibernate.Hql.Ast; required for .AsExpression() to be found
                // at compile time.
                visitor.Visit(arguments[0]).AsExpression(),
                // Below 'Class' method is not 'YourLinqExtensions.Class' extension
                // method. It is natively available on HqlTreeBuilder.
                treeBuilder.Class()));
 }
Exemplo n.º 4
0
 public override NHibernate.Hql.Ast.HqlTreeNode BuildHql(MemberInfo member, Expression expression, NHibernate.Hql.Ast.HqlTreeBuilder treeBuilder, NHibernate.Linq.Visitors.IHqlExpressionVisitor visitor)
 {
     return(treeBuilder.MethodCall("dayofyear", visitor.Visit(expression).AsExpression()));
 }