protected override Expression VisitExists(ExistsExpression exists) { // how did we get here? Translate exists into count query var colType = this.linguist.Language.TypeSystem.GetColumnType(typeof(int)); var newSelect = exists.Select.SetColumns( new[] { new ColumnDeclaration("value", null, new AggregateExpression(typeof(int), "Count", null, false), colType) } ); var projection = new ProjectionExpression( newSelect, new ColumnExpression(typeof(int), colType, newSelect.Alias, "value", null), Aggregator.GetAggregator(typeof(int), typeof(IEnumerable <int>)) ); var expression = projection.GreaterThan(Expression.Constant(0)); return(this.Visit(expression)); }
protected virtual bool CompareExists(ExistsExpression a, ExistsExpression b) { return(this.Compare(a.Select, b.Select)); }
protected virtual Expression VisitExists(ExistsExpression exists) { var select = (SelectExpression)this.Visit(exists.Select); return(this.UpdateExists(exists, select)); }