public void Configure(IApplicationBuilder app, IHostingEnvironment env, IBackGroundService bgr) { app.UseDatabaseMigration(); if (env.IsDevelopment()) { app.UseBrowserLink(); app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseAuthentication(); app.UseHangfireServer(); app.UseHangfireDashboard(); app.UseBackGroundJob(bgr); app.UseSignalR(routes => { routes.MapHub <NotificationsHub>("notifications"); }); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); }
public UploadBackgroundJob(IBackGroundService backGroundService) { this.backGroundService = backGroundService; }
public static void UseBackGroundJob(this IApplicationBuilder app, IBackGroundService bgr) { BackgroundJob.Enqueue(() => new UploadBackgroundJob(bgr).ExecuteJob()); }