public override HqlTreeNode BuildHql(MethodInfo method, Expression targetObject, ReadOnlyCollection<Expression> arguments, HqlTreeBuilder treeBuilder, IHqlExpressionVisitor visitor) { HqlExpression value = visitor.Visit(arguments[0]).AsExpression(); HqlTreeNode inClauseNode = BuildInClause(arguments, treeBuilder, visitor); HqlTreeNode inClause = treeBuilder.In(value, inClauseNode); if (method.Name == "NotIn") inClause = treeBuilder.BooleanNot((HqlBooleanExpression)inClause); return inClause; }
public override HqlTreeNode BuildHql(MethodInfo method, Expression targetObject, ReadOnlyCollection<Expression> arguments, HqlTreeBuilder treeBuilder, IHqlExpressionVisitor visitor) { // All has two arguments. Arg 1 is the source and arg 2 is the predicate var predicate = (LambdaExpression) arguments[1]; return treeBuilder.BooleanNot( treeBuilder.Exists( treeBuilder.Query( treeBuilder.SelectFrom( treeBuilder.From( treeBuilder.Range( visitor.Visit(arguments[0]), treeBuilder.Alias(predicate.Parameters[0].Name)) ) ), treeBuilder.Where( treeBuilder.BooleanNot(visitor.Visit(arguments[1]).AsBooleanExpression()) ) ) ) ); }