private async Task <IEnumerable <IEntropyGenerationResult <T> > > GetEntropyInternal <T>(IEntropyFilter entropyFilter = null) { var limit = entropyFilter != null ? entropyFilter.Limit : 1; if (_entropyPoolRepository.TryGetPool <T>(out var pool)) { var entropy = pool.GetEntropy(limit).Select(x => EntropyGenerationResult <T> .Create(x)); if (entropy.Count() < limit) { var generator = _entropyTypeConfigurationMappingService.GetConfiguration <T>().GeneratorService; if (generator != null) { return((await generator.Fetch(limit - entropy.Count())).Concat(entropy)); } else { throw new NoSuchGeneratorException(); } } else { return(entropy); } } else { throw new PoolDoesNotExistException(); } }
public async Task <IEnumerable <IEntropyGenerationResult <T> > > GetEntropy <T>(IEntropyFilter entropyFilter) => await GetEntropyInternal <T>(entropyFilter);