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
Minor changes with RegisterTasks
support5600728d0f1c
diff --git a/src/Web/Grand.Web.Common/Startup/TaskHandler.cs b/src/Web/Grand.Web.Common/Startup/TaskHandler.csindex b3d934d94..84a615331 100644--- a/src/Web/Grand.Web.Common/Startup/TaskHandler.cs+++ b/src/Web/Grand.Web.Common/Startup/TaskHandler.cs@@ -4,6 +4,7 @@ using Grand.Infrastructure.Configuration;using Grand.Infrastructure.Plugins;using Grand.Infrastructure.TypeSearch;using Grand.Web.Common.Infrastructure;+using Microsoft.Extensions.Configuration;using Microsoft.Extensions.DependencyInjection;using Microsoft.Extensions.Hosting;@@ -12,11 +13,14 @@ namespace Grand.Web.Common.Startuppublic static class TaskHandler{- public static void RegisterTasks(this IServiceCollection services)+ public static void RegisterTasks(this IServiceCollection services, IConfiguration configuration){//database is already installed, so start scheduled tasksif (!DataSettingsManager.DatabaseIsInstalled()) return;- var appConfig = services.BuildServiceProvider().GetRequiredService<AppConfig>();++ var appConfig = new AppConfig();+ configuration.GetSection("Application").Bind(appConfig);+if (appConfig.DisableHostedService) return;var typeSearcher = new TypeSearcher();var scheduleTasks = typeSearcher.ClassesOfType<IScheduleTask>();diff --git a/src/Web/Grand.Web/Program.cs b/src/Web/Grand.Web/Program.csindex f7f9eedf6..7966e0dcb 100644--- a/src/Web/Grand.Web/Program.cs+++ b/src/Web/Grand.Web/Program.cs@@ -21,7 +21,7 @@ StartupBase.ConfigureServices(builder.Services, builder.Configuration);builder.ConfigureApplicationSettings();//register task-builder.Services.RegisterTasks();+builder.Services.RegisterTasks(builder.Configuration);//build appvar app = builder.Build();