public void ConfigureServices()

in src/Services/Infection/Infection.WebApi/Startup.cs [57:108]


        public void ConfigureServices(IServiceCollection services)
        {
            services.AddSerilogWithInsights<Startup>(Configuration);

            services.AddControllers()
                .AddJsonOptions(options => options.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase)
                .ConfigureApiBehaviorOptions(options
                    => options.InvalidModelStateResponseFactory = ModelStateExtensions.InvalidModelStateResponseFactory);


            // Register the Swagger generator, defining 1 or more Swagger documents
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1.0", new OpenApiInfo
                {
                    Version = "v1.0",
                    Title = "Infection API",
                    Description = "Infection API endpoints."
                });

                // Set the comments path for the Swagger JSON and UI.
                var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
                var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
                c.IncludeXmlComments(xmlPath);

                // Uses full schema names to avoid v1/v2/v3 schema collisions
                // see: https://github.com/domaindrivendev/Swashbuckle/issues/442
                c.CustomSchemaIds(x => x.FullName);
            });

            services.AddAutoMapper(typeof(Startup));
            services.Configure<Metadata>(Configuration.GetSection("metadata"));
            services.Configure<Backend>(Configuration.GetSection("backend"));
            services.Configure<CassandraOptions>(Configuration.GetSection("Cassandra"));
            services.AddSingleton<ICassandraCluster, CassandraCluster>();
            services.AddSingleton<ICassandraSession, CassandraSession>();
            services.AddScoped<IStatusChangeRepository, StatusChangeRepository>();
            services.AddScoped<IUserRepository, UserRepository>();
            services.AddScoped<IInfectionService, InfectionService>();
            services.AddScoped<IBlobStorageService, BlobStorageService>();

            services.Configure<BlobOptions>(Configuration.GetSection("Blob"));
            services.AddAzureClients(
                builder =>
                {
                    IConfigurationSection blobConfiguration = Configuration.GetSection("Blob");
                    builder.AddBlobServiceClient(blobConfiguration["ConnectionString"]);
                });

            services.AddIdentityServerAuthentication(Configuration);
            services.AddAuthorization();
        }