/// <summary>
        /// Register an aggregate projection that should be evaluated asynchronously
        /// </summary>
        /// <param name="projection"></param>
        /// <typeparam name="T"></typeparam>
        /// <returns>The extended storage configuration for document T</returns>
        public MartenRegistry.DocumentMappingExpression <T> Async <T>(AggregateProjection <T> projection)
        {
            var expression = _options.Schema.For <T>();

            projection.As <IValidatedProjection>().AssertValidity();
            _asyncProjections.Add(projection);

            return(expression);
        }
        /// <summary>
        /// Use a "self-aggregating" aggregate of type as an inline projection
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns>The extended storage configuration for document T</returns>
        public MartenRegistry.DocumentMappingExpression <T> InlineSelfAggregate <T>()
        {
            // Make sure there's a DocumentMapping for the aggregate
            var expression = _options.Schema.For <T>();
            var source     = new AggregateProjection <T>();

            source.As <IValidatedProjection>().AssertValidity();
            _inlineProjections.Add(source);

            return(expression);
        }
        internal ILiveAggregator <T> AggregatorFor <T>() where T : class
        {
            if (_liveAggregators.TryFind(typeof(T), out var aggregator))
            {
                return((ILiveAggregator <T>)aggregator);
            }

            if (!_liveAggregateSources.TryGetValue(typeof(T), out var source))
            {
                source = new AggregateProjection <T>();
                source.As <IValidatedProjection>().AssertValidity();
            }

            aggregator       = source.As <ILiveAggregatorSource <T> >().Build(_options);
            _liveAggregators = _liveAggregators.AddOrUpdate(typeof(T), aggregator);

            return((ILiveAggregator <T>)aggregator);
        }