0

I'm using two different databases with Nhibernate, for Sql Server I solved reading this post

It works fine with Sql Server, instead Oracle has a different syntax:

Contains("a", "b")>0

I don't know how to do that in this piece of code

    public override HqlTreeNode BuildHql(MethodInfo method,
      System.Linq.Expressions.Expression targetObject,
      ReadOnlyCollection<System.Linq.Expressions.Expression> arguments,
      HqlTreeBuilder treeBuilder, IHqlExpressionVisitor visitor)
    {

        HqlExpression[] args = new HqlExpression[2] {
            visitor.Visit(arguments[0]).AsExpression(),
            visitor.Visit(arguments[1]).AsExpression()
        };


        return treeBuilder.BooleanMethodCall("contains", args);
    }

The problem is I can't understand how to add >0 after the expression.

Thanks in advance

lunatic84
  • 300
  • 4
  • 12

1 Answers1

0

It was simplier than I thought, using the builder solved in this way

public override HqlTreeNode BuildHql(MethodInfo method,
          System.Linq.Expressions.Expression targetObject,
          ReadOnlyCollection<System.Linq.Expressions.Expression> arguments,
          HqlTreeBuilder treeBuilder, IHqlExpressionVisitor visitor)        {           HqlExpression[] args = new HqlExpression[2] {
                visitor.Visit(arguments[0]).AsExpression(),
                visitor.Visit(arguments[1]).AsExpression()          };

            return treeBuilder.GreaterThan(treeBuilder.MethodCall("contains", args), treeBuilder.Constant(0));      }
lunatic84
  • 300
  • 4
  • 12