Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
Fix tasks register order
dkuciacea508322630
diff --git a/src/Web/Grand.Web.Common/Startup/TaskHandlerStartup.cs b/src/Web/Grand.Web.Common/Startup/TaskHandlerHelper.cssimilarity index 54%rename from src/Web/Grand.Web.Common/Startup/TaskHandlerStartup.csrename to src/Web/Grand.Web.Common/Startup/TaskHandlerHelper.csindex 1dbe96ef7..a5f253307 100644--- a/src/Web/Grand.Web.Common/Startup/TaskHandlerStartup.cs+++ b/src/Web/Grand.Web.Common/Startup/TaskHandlerHelper.cs@@ -13,28 +13,12 @@ using System.Linq;namespace Grand.Web.Common.Startup{- /// <summary>- /// Represents object for the configuring task on application startup- /// </summary>- public class TaskHandlerStartup : IStartupApplication+ public static class TaskHandlerHelper{- /// <summary>- /// Configure the using of added middleware- /// </summary>- /// <param name="application">Builder for configuring an application's request pipeline</param>- /// <param name="webHostEnvironment">WebHostEnvironment</param>- public void Configure(IApplicationBuilder application, IWebHostEnvironment webHostEnvironment)- {-- }- /// <summary>- /// Add and configure any of the middleware- /// </summary>- /// <param name="services">Collection of service descriptors</param>- /// <param name="configuration">Configuration root of the application</param>- public void ConfigureServices(IServiceCollection services, IConfiguration configuration)+ public static void RegisterTasks(this IServiceCollection services){+//database is already installed, so start scheduled tasksif (DataSettingsManager.DatabaseIsInstalled()){@@ -54,13 +38,5 @@ namespace Grand.Web.Common.Startup}}}-- /// <summary>- /// Gets order of this startup configuration implementation- /// </summary>- /// task handlers should be loaded last- public int Priority => 1010;- public bool BeforeConfigure => true;-}}diff --git a/src/Web/Grand.Web/Program.cs b/src/Web/Grand.Web/Program.csindex e75a968a6..e3c35c330 100644--- a/src/Web/Grand.Web/Program.cs+++ b/src/Web/Grand.Web/Program.cs@@ -1,4 +1,5 @@-using Microsoft.AspNetCore.Hosting;+using Grand.Web.Common.Startup;+using Microsoft.AspNetCore.Hosting;using Microsoft.Extensions.Configuration;using Microsoft.Extensions.Hosting;using Serilog;@@ -50,6 +51,10 @@ namespace Grand.WebwebBuilder.UseSetting(WebHostDefaults.PreventHostingStartupKey, "true");webBuilder.UseStartup<Startup>();})+ .ConfigureServices(services=>+ {+ services.RegisterTasks();+ }).UseDefaultServiceProvider((context, options) =>{options.ValidateScopes = false;