// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, CityInfoDbContext context) { loggerFactory.AddConsole(); loggerFactory.AddDebug(); //loggerFactory.AddProvider(new NLog.Extensions.Logging.NLogLoggerProvider()); loggerFactory.AddNLog(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } context.EnsureSeedDataForContext(); //show status code instead of blank page (browser) app.UseStatusCodePages(); AutoMapper.Mapper.Initialize(cnf => { cnf.CreateMap <Entities.City, Models.CityInfoWithoutPointsOfInterest>(); cnf.CreateMap <Entities.City, Models.CityDto>(); cnf.CreateMap <Entities.PointOfInterest, Models.PointsOfInterestDto>(); cnf.CreateMap <Models.PointOfInterestForCreationDto, Entities.PointOfInterest>(); cnf.CreateMap <Models.PointOfInterestForUpdateDto, Entities.PointOfInterest>(); cnf.CreateMap <Entities.PointOfInterest, Models.PointOfInterestForUpdateDto>(); }); app.UseMvc(); //app.Run(async (context) => //{ // await context.Response.WriteAsync("Hello World!"); //}); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, CityInfoDbContext context) { loggerFactory.AddConsole(); loggerFactory.AddNLog(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } context.EnsureSeedDataForContext(); app.UseStatusCodePages(); AutoMapper.Mapper.Initialize(map => { map.CreateMap <Entities.City, Models.CityWithoutpointsOfInterestDTO>(); map.CreateMap <Entities.City, Models.CityDTO>(); map.CreateMap <Entities.PointOfInterest, Models.PointOfInterestDTO>(); map.CreateMap <Models.PointOfInterestCreate, Entities.PointOfInterest>(); map.CreateMap <Models.PointOfInterestUpdate, Entities.PointOfInterest>(); map.CreateMap <Entities.PointOfInterest, Models.PointOfInterestUpdate>(); }); app.UseCors(builder => builder.AllowAnyOrigin().AllowAnyMethod()); /*app.UseCors(builder => builder.WithOrigins("http://erickpc:4200"));/*(Configuration.GetSection("Origins:Multiorigins"). * GetChildren().Select(s=>s.Value).Where(s=>s!=string.Empty).ToArray()) * .AllowAnyMethod());*/ app.UseMvc(); //app.Run(async (context) => //{ // await context.Response.WriteAsync(Configuration["TestInfos:Gretings"]); //}); }