Example #1
0
        public async Task <IActionResult> ReloadDb(string size)
        {
            await Task.Run(() =>
            {
                switch (size)
                {
                case "small":
                    _context.Database.EnsureDeleted();
                    MasterDBInitializerBasic.DbInitialize(_context);
                    break;

                case "medium":
                    _context.Database.EnsureDeleted();
                    MasterDBInitializerMedium.DbInitialize(_context);
                    break;

                default:
                    _context.Database.EnsureDeleted();
                    MasterDBInitializerLarge.DbInitialize(_context);
                    break;
                }
            }
                           );

            return(View("Index"));
        }
Example #2
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?}");
            });
        }