// 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, MLPContext mlpcontext) { loggerFactory.AddConsole(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler(appBuilder => { appBuilder.Run(async context => { var exceptionHadlerFeature = context.Features.Get <IExceptionHandlerFeature>(); if (exceptionHadlerFeature != null) { var logger = loggerFactory.CreateLogger("Global exception logger"); logger.LogError(500, exceptionHadlerFeature.Error, exceptionHadlerFeature.Error.Message); } context.Response.StatusCode = 500; await context.Response.WriteAsync("An unexpected fault happened. Try again later."); }); }); } AutoMapper.Mapper.Initialize(cfg => { cfg.CreateMap <Entities.NeuralNetwork, Models.OutputModels.NeuralNetworkDto>() .ForMember(dest => dest.HiddenNeurons, opt => opt.MapFrom(src => src.TrainingConfig.HiddenNeuronElements)) .ForMember(dest => dest.OutputNeurons, opt => opt.MapFrom(src => src.TrainingConfig.OutputNeuronElements)); cfg.CreateMap <Models.InputModels.NeuralNetworkForCreationDto, Entities.NeuralNetwork>(); cfg.CreateMap <Models.InputModels.NeuralNetworkTrainingConfigForCreationDto, Entities.NeuralNetworkTrainingConfig>(); cfg.CreateMap <Models.InputModels.NeuronForCreationDto, Entities.Neuron>(); cfg.CreateMap <Models.InputModels.NeuronWeightForCreationDto, Entities.NeuronWeight>(); cfg.CreateMap <Models.Domain.NeuronWeightForManipulation, Entities.NeuronWeight>(); cfg.CreateMap <Models.InputModels.PredictedObjectForCreationDto, Entities.PredictedObject>(); cfg.CreateMap <Entities.Neuron, Models.Domain.NeuronForManipulation>(); cfg.CreateMap <Entities.NeuralNetworkTrainingConfig, Models.OutputModels.NeuralNetworkTrainingConfigDto>(); cfg.CreateMap <Entities.ImageProcessingConfig, Models.OutputModels.ImageProcessingConfigDto>(); cfg.CreateMap <Models.InputModels.ImageProcessingConfigForCreationDto, Entities.ImageProcessingConfig>(); cfg.CreateMap <Models.InputModels.ImageProcessingConfigWithImageForCreationDto, Models.InputModels.ImageProcessingConfigForCreationDto>(); cfg.CreateMap <Models.OutputModels.ImageProcessingConfigValuesDto, Models.InputModels.ImageProcessingConfigForCreationDto>(); }); //mlpcontext.EnsureSeedDataForContext(); app.UseMvc(); }
public MLPRepository(MLPContext context) { _context = context; }