protected override Expression VisitExists(DbExistsExpression exists) { var colType = this.linguist.Language.TypeSystem.GetColumnType(typeof(int)); var newSelect = exists.Select.SetColumns(new[] { new DbColumnDeclaration("value", new DbAggregateExpression(typeof(int), "Count", null, false), colType) }); var projection = new DbProjectionExpression ( newSelect, new DbColumnExpression(typeof(int), colType, newSelect.Alias, "value"), DbAggregator.GetAggregator(typeof(int), typeof(IEnumerable <int>)) ); return(this.Visit(projection.GreaterThan(Expression.Constant(0)))); }