Beispiel #1
0
        private static void Configure(IServiceCollection services, IConfigurationRoot configuration)
        {
            services.AddTransient(x => DbContextStartup.Workflow(x, false));
            services.AddTransient(x => DbContextStartup.Content(x, false));
            services.AddTransient(x => DbContextStartup.Publishing(x, false));

            services.AddTransient <Func <WorkflowDbContext> >(x => x.GetService <WorkflowDbContext>);
            services.AddTransient <Func <PublishingJobDbContext> >(x => x.GetService <PublishingJobDbContext>);
            services.AddTransient <Func <ContentDbContext> >(x => x.GetService <ContentDbContext>);

            services.AddScoped <IUtcDateTimeProvider, StandardUtcDateTimeProvider>();

            services.AddSingleton <IConfiguration>(configuration);
            services.AddSingleton <ITekValidatorConfig, TekValidatorConfig>();
            services.AddSingleton <IEksHeaderInfoConfig, EksHeaderInfoConfig>();
            services.AddSingleton <IEksConfig, StandardEksConfig>();

            services.AddTransient <ITransmissionRiskLevelCalculation, TransmissionRiskLevelCalculationV1>();
            services.AddTransient <ExposureKeySetBatchJobMk3>();
            services.AddTransient <IRandomNumberGenerator, StandardRandomNumberGenerator>();
            services.AddTransient <IEksStuffingGenerator, EksStuffingGenerator>();
            services.AddTransient <IPublishingIdService, Sha256HexPublishingIdService>();
            services.AddTransient <EksBuilderV1>();
            services.AddTransient <GeneratedProtobufEksContentFormatter>();
            services.AddTransient <IEksBuilder, EksBuilderV1>();
            services.AddTransient <IEksContentFormatter, GeneratedProtobufEksContentFormatter>();
            services.AddTransient <ISnapshotEksInput, SnapshotEksInputMk1>();
            services.AddTransient <IMarkWorkFlowTeksAsUsed, MarkWorkFlowTeksAsUsed>();
            services.AddTransient <EksJobContentWriter>();

            services.NlSignerStartup(configuration.UseCertificatesFromResources());
            services.GaSignerStartup(configuration.UseCertificatesFromResources());
        }
Beispiel #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddScoped(x => DbContextStartup.Workflow(x, false));
            services.AddScoped(x => DbContextStartup.Content(x, false));
            services.AddScoped(x => DbContextStartup.Publishing(x, false));

            services.AddTransient <ContentValidator>();
            services.AddTransient <ContentInsertDbCommand>();

            services.NlSignerStartup(_Configuration.UseCertificatesFromResources());
            services.GaSignerStartup(_Configuration.UseCertificatesFromResources());

            // Database Scoping
            services.AddScoped(x =>
            {
                var config  = new StandardEfDbConfig(_Configuration, "WorkFlow");
                var builder = new SqlServerDbContextOptionsBuilder(config);
                var result  = new WorkflowDbContext(builder.Build());
                result.BeginTransaction();
                return(result);
            });

            services.AddScoped <IUtcDateTimeProvider, StandardUtcDateTimeProvider>();
            services.AddTransient <IPublishingIdService, Sha256HexPublishingIdService>();
            services.AddTransient <ZippedSignedContentFormatter>();

            services.AddControllersWithViews();
        }
        private static void Configure(IServiceCollection services, IConfigurationRoot configuration)
        {
            services.AddSingleton <IConfiguration>(configuration);
            services.AddScoped <IUtcDateTimeProvider, StandardUtcDateTimeProvider>();
            services.AddScoped(x => DbContextStartup.Workflow(x, false));
            services.AddScoped(x => DbContextStartup.Content(x, false));
            services.AddScoped(x => DbContextStartup.Publishing(x, false));

            services.AddTransient <WorkflowDatabaseCreateCommand>();
            services.AddTransient <PublishingJobDatabaseCreateCommand>();
            services.AddTransient <ContentDatabaseCreateCommand>();

            services.AddSingleton <IWorkflowConfig, WorkflowConfig>();
            services.AddSingleton <ITekValidatorConfig, TekValidatorConfig>();
            services.AddSingleton <IEksConfig, StandardEksConfig>();

            services.AddTransient <IRandomNumberGenerator, StandardRandomNumberGenerator>();
            services.AddTransient <ILabConfirmationIdService, LabConfirmationIdService>();
            services.AddTransient <IJsonSerializer, StandardJsonSerializer>();
            services.AddTransient <ProvisionDatabasesCommand>();
            services.AddTransient <IPublishingIdService, Sha256HexPublishingIdService>();
            services.AddTransient <ContentValidator>();
            services.AddTransient <ContentInsertDbCommand>();
            services.AddTransient <ZippedSignedContentFormatter>();

            services.NlSignerStartup(configuration.UseCertificatesFromResources());
        }
Beispiel #4
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddLogging();

            services.AddControllers(options =>
            {
                options.RespectBrowserAcceptHeader = true;
            });

            services.AddLogging();

            services.AddScoped <IUtcDateTimeProvider, StandardUtcDateTimeProvider>();

            services.AddScoped(x => DbContextStartup.Workflow(x, false));
            services.AddScoped(x => DbContextStartup.Content(x, false));
            services.AddScoped(x => DbContextStartup.Publishing(x, false));

            services.GaSignerStartup(_Configuration.UseCertificatesFromResources());
            services.NlSignerStartup(_Configuration.UseCertificatesFromResources());

            services.AddSingleton <IEksHeaderInfoConfig, EksHeaderInfoConfig>();
            services.AddSingleton <IEksConfig, StandardEksConfig>();
            services.AddSingleton <IWorkflowConfig, WorkflowConfig>();
            services.AddSingleton <ITekValidatorConfig, TekValidatorConfig>();

            services.AddTransient <ITransmissionRiskLevelCalculation, TransmissionRiskLevelCalculationV1>();
            services.AddTransient <ExposureKeySetBatchJobMk3>();
            services.AddTransient <IEksContentFormatter, GeneratedProtobufEksContentFormatter>();
            services.AddTransient <EksBuilderV1>();
            services.AddTransient <IPublishingIdService, Sha256HexPublishingIdService>();
            services.AddTransient <ManifestBatchJob>();
            services.AddTransient <ManifestBuilder>();
            services.AddTransient <ManifestBuilderAndFormatter>();
            services.AddTransient <IContentEntityFormatter, StandardContentEntityFormatter>();
            services.AddTransient <ZippedSignedContentFormatter>();
            services.AddTransient <IJsonSerializer, StandardJsonSerializer>();
            services.AddTransient <IEksBuilder, EksBuilderV1>();
            services.AddTransient <IEksStuffingGenerator, EksStuffingGenerator>();
            services.AddTransient <IRandomNumberGenerator, StandardRandomNumberGenerator>();
            services.AddTransient <WorkflowDatabaseCreateCommand>();
            services.AddTransient <PublishingJobDatabaseCreateCommand>();
            services.AddTransient <ContentDatabaseCreateCommand>();
            services.AddTransient <ProvisionDatabasesCommand>();
            services.AddTransient <IPublishingIdService, Sha256HexPublishingIdService>();
            services.AddTransient <ContentValidator>();
            services.AddTransient <ContentInsertDbCommand>();
            services.AddTransient <ZippedSignedContentFormatter>();
            services.AddTransient <ILabConfirmationIdService, LabConfirmationIdService>();

            services.AddSwaggerGen(o =>
            {
                o.SwaggerDoc("v1", new OpenApiInfo {
                    Title = Title, Version = "v1"
                });
            });
        }
Beispiel #5
0
        private static void Configure(IServiceCollection services, IConfigurationRoot configuration)
        {
            services.AddTransient(x => DbContextStartup.Workflow(x, false));
            services.AddTransient(x => DbContextStartup.Content(x, false));
            services.AddTransient(x => DbContextStartup.Publishing(x, false));
            services.AddTransient(x => DbContextStartup.Stats(x, false));

            services.AddTransient <Func <WorkflowDbContext> >(x => x.GetService <WorkflowDbContext>);
            services.AddTransient <Func <PublishingJobDbContext> >(x => x.GetService <PublishingJobDbContext>);
            services.AddTransient <Func <ContentDbContext> >(x => x.GetService <ContentDbContext>);

            services.AddScoped <IUtcDateTimeProvider, StandardUtcDateTimeProvider>();

            services.AddSingleton <IConfiguration>(configuration);
            services.AddSingleton <ITekValidatorConfig, TekValidatorConfig>();
            services.AddSingleton <IEksHeaderInfoConfig, EksHeaderInfoConfig>();
            services.AddSingleton <IEksConfig, StandardEksConfig>();

            services.AddTransient <ITransmissionRiskLevelCalculation, TransmissionRiskLevelCalculationV1>();
            services.AddTransient <ExposureKeySetBatchJobMk3>();
            services.AddTransient <IRandomNumberGenerator, StandardRandomNumberGenerator>();
            services.AddTransient <IEksStuffingGenerator, EksStuffingGenerator>();
            services.AddTransient <IPublishingIdService, Sha256HexPublishingIdService>();
            services.AddTransient <EksBuilderV1>();
            services.AddTransient <GeneratedProtobufEksContentFormatter>();
            services.AddTransient <IEksBuilder, EksBuilderV1>();
            services.AddTransient <IEksContentFormatter, GeneratedProtobufEksContentFormatter>();
            services.AddTransient <ISnapshotEksInput, SnapshotEksInputMk1>();
            services.AddTransient <IMarkWorkFlowTeksAsUsed, MarkWorkFlowTeksAsUsed>();
            services.AddTransient <EksJobContentWriter>();

            services.AddTransient <ManifestUpdateCommand>();
            services.AddTransient <IJsonSerializer, StandardJsonSerializer>();

            services.AddTransient <ManifestBuilder>();
            services.AddTransient <IContentEntityFormatter, StandardContentEntityFormatter>();
            services.AddTransient <ZippedSignedContentFormatter>();

            services.AddTransient <RemoveExpiredManifestsCommand>();
            services.AddTransient <RemoveExpiredManifestsV2Command>();
            services.AddTransient <RemoveExpiredEksCommand>();
            services.AddTransient <RemoveExpiredEksV2Command>();
            services.AddTransient <RemoveExpiredWorkflowsCommand>();

            services.AddSingleton <IManifestConfig, ManifestConfig>();
            services.AddSingleton <IWorkflowConfig, WorkflowConfig>();

            services.NlResignerStartup();

            services.DummySignerStartup();
            services.GaSignerStartup();

            services.DailyStatsStartup();
        }