public static ConfigurationResult <T> MergeSourceResults <T>(ConfigurationResult <T> accumulator, IConfigurationSource source) where T : class, IConfigured, new() { var nextResult = source.Get(accumulator); nextResult.Observable = accumulator.Observable.Merge(nextResult.Observable); return(nextResult); }
public void Store <T>(ConfigurationResult <T> configurationResult) where T : class, IConfigured, new() { UpdateResult(configurationResult.Result); lock (StoreLocker) { var sub = configurationResult.Observable.Subscribe(UpdateResult); _subscriptions.Add(sub); } }
public ConfigurationResult <T> Resolve <T>() where T : class, IConfigured, new() { var handlingSources = _sources.Where(s => s.Handles <T>()).ToList(); var accumulator = new ConfigurationResult <T>(new T(), Observable.Empty <T>()); var configurationResult = handlingSources.Aggregate(accumulator, MergeSourceResults); return(configurationResult); }