public static Collector CreateCountCollector(AddSqlCountCollectorToConfigCommand command) { CountBaseCollector collector = null; switch (command.SourceProvider) { case SqlCollectorSourceProvider.PostgreSql: collector = new Implementation.Collectors.Sql.PostgreSql.CountCollector(); break; case SqlCollectorSourceProvider.Oracle: collector = new Implementation.Collectors.Sql.Oracle.CountCollector(); break; case SqlCollectorSourceProvider.MySql: collector = new Implementation.Collectors.Sql.MySql.CountCollector(); break; case SqlCollectorSourceProvider.MsSql: collector = new Implementation.Collectors.Sql.MsSql.CountCollector(); break; default: throw new NotSupportedException($"{command.SourceProvider} has no support for the CountCollector"); } collector.ConnectionString = command.ConnectionString; collector.TableName = command.TableName; collector.WhereClause = command.WhereClause; return(collector); }
public async Task <ActionResult <string> > AddSqlCountCollector(string collectorConfigId, [FromBody] AddSqlCountCollectorToConfigCommand command) { await _collectorConfigService.AddCollectorAsync(Uri.UnescapeDataString(collectorConfigId), command); return(Ok()); }