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))); }
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)); }
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()));