Started implementing the aggregation framework in the services, but backed because of the many points in which to look.
The count aggregation framework is operative in the container; it is looking more and more plausible to use the DISTINCT parameter for both the distinct and the aggregation framework: if it is a scalar we use distinct, if it is an array we use the aggregation. Need to check CDataWrapper::_Query() method: it's a bit convoluted.