public HqlTreeNode BuildHql(MethodInfo method, Expression targetObject, ReadOnlyCollection<Expression> arguments, HqlTreeBuilder treeBuilder, IHqlExpressionVisitor visitor) { return treeBuilder.Like( visitor.Visit(arguments[0]).AsExpression(), visitor.Visit(arguments[1]).AsExpression()); }
public override HqlTreeNode BuildHql(MethodInfo method, Expression targetObject, ReadOnlyCollection<Expression> arguments, HqlTreeBuilder treeBuilder, IHqlExpressionVisitor visitor) { return treeBuilder.Like( visitor.Visit(targetObject).AsExpression(), treeBuilder.Concat( treeBuilder.Constant("%"), visitor.Visit(arguments[0]).AsExpression())); }
public HqlTreeNode BuildHql(MethodInfo method, Expression targetObject, ReadOnlyCollection<Expression> arguments, HqlTreeBuilder treeBuilder, IHqlExpressionVisitor visitor) { if (arguments.Count == 2) { return treeBuilder.Like( visitor.Visit(arguments[0]).AsExpression(), visitor.Visit(arguments[1]).AsExpression()); } if (arguments[2].NodeType == ExpressionType.Constant) { var escapeCharExpression = (ConstantExpression)arguments[2]; return treeBuilder.Like( visitor.Visit(arguments[0]).AsExpression(), visitor.Visit(arguments[1]).AsExpression(), treeBuilder.Constant(escapeCharExpression.Value)); } throw new ArgumentException("The escape character must be specified as literal value or a string variable"); }