public override async Task <CrawlJobData> GetCrawlJobData( ProviderUpdateContext context, IDictionary <string, object> configuration, Guid organizationId, Guid userId, Guid providerDefinitionId) { if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } var sqlCrawlJobData = new SQLCrawlJobData(); if (configuration.ContainsKey(SQLConstants.KeyName.ConnectionString)) { sqlCrawlJobData.ConnectionString = configuration[SQLConstants.KeyName.ConnectionString].ToString(); } if (configuration.ContainsKey(SQLConstants.KeyName.TableName)) { sqlCrawlJobData.TableName = configuration[SQLConstants.KeyName.TableName].ToString(); } return(await Task.FromResult(sqlCrawlJobData)); }
public SQLClient(ILogger <SQLClient> log, SQLCrawlJobData sqlCrawlJobData, IRestClient client) // TODO: pass on any extra dependencies { if (sqlCrawlJobData == null) { throw new ArgumentNullException(nameof(sqlCrawlJobData)); } if (client == null) { throw new ArgumentNullException(nameof(client)); } this.log = log ?? throw new ArgumentNullException(nameof(log)); this.client = client ?? throw new ArgumentNullException(nameof(client)); // TODO use info from sqlCrawlJobData to instantiate the connection client.BaseUrl = new Uri(BaseUri); client.AddDefaultParameter("api_key", sqlCrawlJobData.ConnectionString, ParameterType.QueryString); }