public IAggregator <T> AggregateFor <T>() where T : class { if (!_aggregates.Value.TryFind(typeof(T), out var aggregator)) { Options.Storage.MappingFor(typeof(T)); aggregator = _aggregatorLookup.Lookup <T>(); _aggregates.Swap(a => a.AddOrUpdate(typeof(T), aggregator)); } return(aggregator.As <IAggregator <T> >()); }
public IAggregator <T> AggregateFor <T>() where T : class, new() { return(_aggregates .GetOrAdd(typeof(T), type => { Options.Storage.MappingFor(typeof(T)); return _aggregatorLookup.Lookup <T>(); }) .As <IAggregator <T> >()); }