public HomeController(GeoDatabaseContext dbContext) { _databaseContext = dbContext; }
public Repository(GeoDatabaseContext context) { DbContext = context; }
// 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, GeoDatabaseContext dbContext) { env.ConfigureNLog("nlog.config"); loggerFactory.AddNLog(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseHsts(); app.UseExceptionHandler(appBuilder => { // Глобальный обработчик ошибок. Логирование ошибки и возврат сообщения с кодом 500. appBuilder.Run(async context => { IExceptionHandlerFeature exceptionHandlerFeature = context.Features.Get <IExceptionHandlerFeature>(); if (exceptionHandlerFeature != null) { ILogger logger = loggerFactory.CreateLogger("Global exception logger"); logger.LogError(500, exceptionHandlerFeature.Error, exceptionHandlerFeature.Error.Message); } context.Response.StatusCode = 500; await context.Response.WriteAsync("An unexpected fault happened. Try again later."); }); }); } app.UseHttpsRedirection(); app.UseStaticFiles(); dbContext.Load(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); }
public RangeRepository(GeoDatabaseContext databaseContext) : base(databaseContext) { }
public LocationRepository(GeoDatabaseContext databaseContext) : base(databaseContext) { }