public void ClearHangfire()
        {
            HangfireDBContext dbContext = new HangfireDBContext(options: new DbContextOptionsBuilder <HangfireDBContext>()
                                                                .UseSqlServer(connectionString: hangfireCtxString)
                                                                .Options);

            dbContext.Database.EnsureDeleted();
            dbContext.Database.EnsureCreated();
            HangfireDBInitializer.DbInitialize(context: dbContext);
        }
Beispiel #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
                              , HangfireDBContext hangfireContext
                              , MasterDBContext context
                              , ResultContext contextResults
                              , ProductionDomainContext productionDomainContext)
        {
            MasterDbInitializerTable.DbInitialize(context: context);
            ResultDBInitializerBasic.DbInitialize(context: contextResults);

            #region Hangfire

            HangfireDBInitializer.DbInitialize(context: hangfireContext);
            GlobalConfiguration.Configuration
            .UseFilter(filter: new AutomaticRetryAttribute {
                Attempts = 0
            })
            .UseSqlServerStorage(nameOrConnectionString: Configuration.GetConnectionString(name: "Hangfire"))
            .UseConsole();
            app.UseHangfireDashboard();

            #endregion

            var options = app.ApplicationServices.GetService <IOptions <RequestLocalizationOptions> >();
            app.UseRequestLocalization(options: options.Value);

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler(errorHandlingPath: "/Home/Error");
            }

            app.UseCors("CorsPolicy");
            app.UseFileServer();
            app.UseStaticFiles();
            app.UseRouting();
            app.UseEndpoints(router => { router.MapHub <MessageHub>("/MessageHub"); });

            app.UseMvc(configureRoutes: routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }
        public void InitializeRemote()
        {
            ResultContext results = ResultContext.GetContext(resultCon: remoteResultCtxString);

            results.Database.EnsureDeleted();
            results.Database.EnsureCreated();
            ResultDBInitializerBasic.DbInitialize(results);

            MasterDBContext masterCtx = MasterDBContext.GetContext(remoteMasterCtxString);

            masterCtx.Database.EnsureDeleted();
            masterCtx.Database.EnsureCreated();
            MasterDBInitializerTruck.DbInitialize(masterCtx, resourceModelSize: ModelSize.Small, setupModelSize: ModelSize.Small, ModelSize.Small, 3, false);

            HangfireDBContext dbContext = new HangfireDBContext(options: new DbContextOptionsBuilder <HangfireDBContext>()
                                                                .UseSqlServer(connectionString: hangfireCtxString)
                                                                .Options);

            dbContext.Database.EnsureDeleted();
            dbContext.Database.EnsureCreated();
            HangfireDBInitializer.DbInitialize(context: dbContext);
        }
Beispiel #4
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
                              , HangfireDBContext hangfireContext
                              , MasterDBContext context
                              , ProductionDomainContext productionDomainContext)
        {
            Task.Run((() => {
                //MasterDBInitializerLarge.DbInitialize(context);
                MasterDBInitializerLarge.DbInitialize(context);
            }
                      ));
            HangfireDBInitializer.DbInitialize(hangfireContext);
            var options = app.ApplicationServices.GetService <IOptions <RequestLocalizationOptions> >();

            app.UseRequestLocalization(options.Value);
            GlobalConfiguration.Configuration.UseFilter(new AutomaticRetryAttribute {
                Attempts = 0
            });

            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseFileServer();
            app.UseStaticFiles();
            // app.UseSignalR();
            app.UseSignalR(router =>
            {
                router.MapHub <MessageHub>("/MessageHub");
            });

            var serverOptions = new BackgroundJobServerOptions()
            {
                ServerName = "ProcessingUnit",
            };

            app.UseHangfireServer(serverOptions);
            app.UseHangfireDashboard();

            app.UseSwagger();

            // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.), specifying the Swagger JSON endpoint.
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "API DOC V1");
            });


            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }
        // 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
                              , HangfireDBContext hangfireContext
                              , MasterDBContext context
                              , ResultContext contextResults
                              , ProductionDomainContext productionDomainContext)
        {
            //MasterDBInitializerLarge.DbInitialize(context);
            //MasterDBInitializerLarge.DbInitialize(context);
            MasterDbInitializerTable.DbInitialize(context: context);

            ResultDBInitializerBasic.DbInitialize(context: contextResults);

            HangfireDBInitializer.DbInitialize(context: hangfireContext);
            var options = app.ApplicationServices.GetService <IOptions <RequestLocalizationOptions> >();

            app.UseRequestLocalization(options: options.Value);
            GlobalConfiguration.Configuration.UseFilter(filter: new AutomaticRetryAttribute {
                Attempts = 0
            });

            #region Hangfire
            GlobalConfiguration.Configuration.UseSqlServerStorage(nameOrConnectionString: Configuration.GetConnectionString(name: "Hangfire"));

            app.UseHangfireDashboard();
            app.UseHangfireServer();
            #endregion

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler(errorHandlingPath: "/Home/Error");
            }

            app.UseFileServer();
            app.UseStaticFiles();
            // app.UseSignalR();
            app.UseSignalR(configure: router =>
            {
                router.MapHub <MessageHub>(path: "/MessageHub");
            });

            var serverOptions = new BackgroundJobServerOptions()
            {
                ServerName = "ProcessingUnit",
            };
            app.UseHangfireServer(options: serverOptions);
            app.UseHangfireDashboard();

            app.UseSwagger();

            // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.), specifying the Swagger JSON endpoint.
            app.UseSwaggerUI(setupAction: c =>
            {
                c.SwaggerEndpoint(url: "/swagger/v1/swagger.json", name: "API DOC V1");
            });


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