Esempio n. 1
0
        public async Task <string> LoadProvider(IDictionary <string, ProviderCategoryConfiguration> configs)
        {
            statisticsProviderLoader = new ProviderLoader <IProvider>();

            if (!configs.ContainsKey(providerKind))
            {
                return(null);
            }

            var statsProviders = configs[providerKind].Providers;

            if (statsProviders.Count == 0)
            {
                return(null);
            }
            if (statsProviders.Count > 1)
            {
                throw new ArgumentOutOfRangeException(providerKind + "Providers",
                                                      string.Format("Only a single {0} provider is supported.", providerKind));
            }
            statisticsProviderLoader.LoadProviders(statsProviders, this);
            await statisticsProviderLoader.InitProviders(runtime);

            return(statisticsProviderLoader.GetProviders().First().Name);
        }
Esempio n. 2
0
 // used only for testing
 internal async Task LoadEmptyProviders()
 {
     statisticsProviderLoader = new ProviderLoader <IProvider>();
     statisticsProviderLoader.LoadProviders(new Dictionary <string, IProviderConfiguration>(), this);
     await statisticsProviderLoader.InitProviders(runtime);
 }