Like() public method

public Like ( HqlExpression lhs, HqlExpression rhs ) : HqlLike
lhs HqlExpression
rhs HqlExpression
return HqlLike
		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());
		}
Example #2
0
 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");

		}