Пример #1
0
        static IServiceCollection ConfigureExportOptions(this IServiceCollection services, IConfiguration config)
        {
            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.SuperToken = config.GetByProxy(Config.Export.REDCap.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.REDCap = rc;
            });

            return(services);
        }
Пример #2
0
 public REDCapExportOptionsDTO(REDCapExportOptions redcapOptions)
 {
     ApiURI    = redcapOptions.ApiURI;
     Scope     = redcapOptions.Scope;
     BatchSize = redcapOptions.BatchSize;
     RowLimit  = redcapOptions.RowLimit;
     Enabled   = redcapOptions.Enabled;
 }
Пример #3
0
        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);
        }
Пример #4
0
 public REDCapExportService(IOptions <ExportOptions> options, HttpClient client, ILogger <REDCapExportService> logger)
 {
     this.options = options.Value.REDCap;
     this.client  = client;
     this.logger  = logger;
 }