18 using Newtonsoft.Json;
22 using System.Collections.Generic;
34 public event EventHandler<DataProviderNewDataRequestEventArgs>
NewDataRequest;
36 private readonly List<IDataProvider> _dataProviders;
43 _dataProviders =
new List<IDataProvider>();
45 var dataProvidersConfig =
Config.
Get(
"composite-data-providers");
46 if (!
string.IsNullOrEmpty(dataProvidersConfig))
48 var dataProviders = JsonConvert.DeserializeObject<List<string>>(dataProvidersConfig);
49 foreach (var dataProvider
in dataProviders)
54 if (_dataProviders.Count == 0)
56 throw new ArgumentException(
"CompositeDataProvider(): requires at least 1 valid data provider in 'composite-data-providers'");
61 throw new ArgumentException(
"CompositeDataProvider(): requires 'composite-data-providers' to be set with a valid type name");
64 _dataProviders.ForEach(x => x.NewDataRequest += OnNewDataRequest);
74 for (var i = 0; i < _dataProviders.Count; i++)
76 var result = _dataProviders[i].Fetch(key);