public void Configure(
            IApplicationBuilder app,
            IHostingEnvironment env,
            ILoggerFactory loggerFactory,
            AppMigrationSeedManager seeder)
        {
            //loggerFactory.AddConsole(Configuration.GetSection("Logging"));

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
                app.UseBrowserLink();

                loggerFactory.AddDebug(LogLevel.Information);
                loggerFactory.AddDatabase(LogLevel.Error);
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");

                loggerFactory.AddDebug(LogLevel.Error);
                loggerFactory.AddDatabase(LogLevel.Critical);
            }

            app.UseStaticFiles();

            app.UseMvc(
                routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=App}/{action=Index}/{id?}");
            }
                );


            if (this.Configuration.IsMigration())
            {
                seeder.MigrateAndSeed();
            }
        }
Esempio n. 2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            //метод расшіренія, созданный намі
            loggerFactory.AddDatabase(new BelTwitContext(Helper.BelTwitDbOptions));

            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
Esempio n. 3
0
        // 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, AppSettings appSettings)
        {
            loggerFactory.AddDatabase(new DatabaseLoggerSettings()
            {
                ConnectionString = appSettings.Data.Logs.ConnectionString,
                MinimumLogLevel  = (LogLevel)appSettings.Data.Logs.MinimumLogLevel,
                TableName        = "Logs"
            });

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseDefaultFiles();
            app.UseStaticFiles();
            app.UseAuthentication();
            app.UseCors(builder => builder
                        .WithOrigins("http://localhost:4200")
                        .AllowAnyOrigin()
                        .AllowCredentials()
                        .AllowAnyHeader()
                        .AllowAnyMethod()
                        );

            AutoMapperInitializer.Initialize();

            app.UseSignalR(routes =>
            {
                routes.MapHub <NotificationHub>("notifications");
            });

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }