// This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var webinarConfig        = new WebinarConfiguration();
            var webinarConfigSection = Configuration.GetSection(WebinarConfiguration.SECTION_NAME);

            webinarConfigSection.Bind(webinarConfig);
            services.AddSingleton(webinarConfig);

            services.AddAutoMapper(typeof(Startup));
            services.AddSingleton <ProductsService>();
            services.AddResponseCompression(options =>
            {
                options.Providers.Clear();
                options.Providers.Add <GzipCompressionProvider>();
            });
            services.Configure <GzipCompressionProviderOptions>(config =>
            {
                config.Level = System.IO.Compression.CompressionLevel.Optimal;
            });

            services.AddControllers();
        }
Exemple #2
0
 public ProductsController(ProductsService productsService, WebinarConfiguration webinarConfiguration)
 {
     ProductsService      = productsService;
     WebinarConfiguration = webinarConfiguration;
 }