Пример #1
0
 public async Task <Configuration?> GetConfiguration(
     string connector,
     string name,
     [Service] IConfigurationDatabase configurationDatabase)
 => (await configurationDatabase.GetConfigurationSource(connector, name)) is null
         ? null
         : new Configuration(connector, name);
Пример #2
0
        public async Task <Flow> SetFlow(
            string name,
            SourceConfig?source,
            [Service] IConfigurationDatabase configurationDatabase)
        {
            await configurationDatabase.SetFlow(name, source);

            return(new Flow(name));
        }
Пример #3
0
        public async Task <Configuration> SetConfiguration(
            string connector,
            string name,
            SourceConfig?source,
            [Service] IConfigurationDatabase configurationDatabase)
        {
            await configurationDatabase.SetConfiguration(connector, name, source);

            return(new Configuration(connector, name));
        }
Пример #4
0
        public async Task <IEnumerable <Configuration> > GetConnections(
            [Service] IConfigurationDatabase database)
        {
            var configDict = await database.ListConfigurations();

            if (!configDict.TryGetValue(Name, out var items))
            {
                return(Enumerable.Empty <Configuration>());
            }
            return(items.Select(o => new Configuration(Name, o)));
        }
Пример #5
0
        public async Task <Configuration?> GetConnection(
            string name,
            [Service] IConfigurationDatabase database)
        {
            var configDict = await database.ListConfigurations();

            if (!configDict.TryGetValue(Name, out var items) || !items.Contains(name))
            {
                return(null);
            }
            return(new Configuration(Name, name));
        }
Пример #6
0
 public async Task <SourceConfig?> GetConfig(
     [Parent] Configuration configuration,
     [Service] IConfigurationDatabase configurationDatabase)
 => await configurationDatabase.GetConfigurationSource(configuration.Connector, configuration.Name);
Пример #7
0
 public Task <SourceConfig?> GetConfig(
     [Parent] Flow flow,
     [Service] IConfigurationDatabase configurationDatabase)
 => configurationDatabase.GetFlowSource(flow.Name);
Пример #8
0
 public bool GetIsReadOnly(
     [Service] IConfigurationDatabase configurationDatabase)
 => configurationDatabase.IsReadOnly;
Пример #9
0
 public async Task <IEnumerable <Flow> > GetFlows(
     [Service] IConfigurationDatabase configurationDatabase)
 => (await configurationDatabase.ListFlows())
 .Select(o => new Flow(o));
Пример #10
0
 public async Task <Flow?> GetFlow(
     string name,
     [Service] IConfigurationDatabase configurationDatabase)
 => (await configurationDatabase.GetFlowSource(name)) is null
         ? null
         : new Flow(name);
Пример #11
0
 public async Task <IEnumerable <Connection> > GetConnections(
     [Service] IConfigurationDatabase configurationDatabase)
 => (await configurationDatabase.ListConfigurations())
 .Select(o => new Connection(o.Key, o.Value.Select(value => new Configuration(o.Key, value)).ToList()));
 public ConfigurationProviderReceiver(IConfigurationProviderNotifier notifier, IConfigurationDatabase database)
 {
     this.notifier = notifier;
     this.database = database;
 }