Esempio n. 1
0
 // This method gets called by the runtime. Use this method to add services to the container.
 public static void ConfigureServices(IServiceCollection services)
 {
     Injection.Init(services);
     AutoMapperConfig.Register(services);
     services.AddSwaggerGen(sw =>
     {
         sw.SwaggerDoc("v1", new Info
         {
             Title       = "Desafio de Desenvolvimento",
             Description = "Desafio de Desenvolvimento da Ativa Investimento",
             Version     = "v1"
         });
     }
                            );
     services.Configure <GzipCompressionProviderOptions>(
         options => options.Level = CompressionLevel.Optimal);
     services.AddResponseCompression(options =>
     {
         options.Providers.Add <GzipCompressionProvider>();
         options.EnableForHttps = true;
     });
     services.AddMvc()
     .SetCompatibilityVersion(CompatibilityVersion.Version_2_2)
     .AddJsonOptions(opcoes =>
     {
         opcoes.SerializerSettings.NullValueHandling =
             Newtonsoft.Json.NullValueHandling.Ignore;
     })
     ;
 }