static IServiceCollection ConfigureExportOptions(this IServiceCollection services, IConfiguration config) { var csv = new CSVExportOptions { Enabled = config.GetValue <bool>(Config.Export.CSV.Enabled) }; var rc = new REDCapExportOptions { Enabled = config.GetValue <bool>(Config.Export.REDCap.Enabled) }; if (rc.Enabled) { rc.ApiURI = config.GetValue <string>(Config.Export.REDCap.ApiURI); rc.BatchSize = config.GetValue <int>(Config.Export.REDCap.BatchSize); rc.RowLimit = config.GetValue <int>(Config.Export.REDCap.RowLimit); rc.Scope = config.GetValue <string>(Config.Export.REDCap.Scope); rc.IncludeScopeInUsername = config.GetValue <bool>(Config.Export.REDCap.IncludeScopeInUsername); config.TryGetByProxy(Config.Export.REDCap.SuperToken, out string superToken); if (!string.IsNullOrWhiteSpace(superToken)) { rc.SuperToken = superToken; } } services.Configure <REDCapExportOptions>(opts => { opts.Enabled = rc.Enabled; opts.ApiURI = rc.ApiURI; opts.BatchSize = rc.BatchSize; opts.RowLimit = rc.RowLimit; opts.Scope = rc.Scope; opts.SuperToken = rc.SuperToken; }); services.Configure <ExportOptions>(opts => { opts.CSV = csv; opts.REDCap = rc; }); return(services); }
public CSVExportOptionsDTO(CSVExportOptions csvOptions) { Enabled = csvOptions.Enabled; }