示例#1
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            services.AddMvc()
            .AddJsonOptions(options =>
            {
                options.SerializerSettings.Formatting = Formatting.Indented;
            });

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new Info {
                    Title = "Consultório Itix", Version = "v1"
                });
            });

            services.AddCors(options =>
            {
                options.AddPolicy("AllowSpecificOrigins", builder =>
                                  builder
                                  .WithOrigins("http://localhost.8000", "https://itix-client.herokuapp.com")
                                  .AllowAnyOrigin()
                                  .AllowAnyMethod()
                                  .AllowAnyHeader()
                                  );
            });

            // Application - Register Services
            Injection.RegisterServices(services);
        }
示例#2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();

            services.AddAutoMapper(typeof(Aplicacao.Servidor.ApiService.AutoMapper.AutoMapperConfiguration));
            //  services.AddAutoMapper();
            Injection.RegisterServices(services);
        }