refactor: 重命名内置后台任务注入方法名称

This commit is contained in:
Argo Zhang 2019-09-03 23:38:15 +08:00
parent 40d3aa3e97
commit bf51dca5d0
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
2 changed files with 7 additions and 6 deletions

View File

@ -63,7 +63,7 @@ namespace Bootstrap.Admin
services.AddBootstrapAdminAuthentication(); services.AddBootstrapAdminAuthentication();
services.AddSwagger(); services.AddSwagger();
services.AddButtonAuthorization(MenuHelper.RetrieveAllMenus); services.AddButtonAuthorization(MenuHelper.RetrieveAllMenus);
services.AddDemoTask(); services.AddBootstrapAdminBackgroundTask();
services.AddHttpClient<GiteeHttpClient>(); services.AddHttpClient<GiteeHttpClient>();
services.AddAdminHealthChecks(); services.AddAdminHealthChecks();
services.AddMvc(options => services.AddMvc(options =>

View File

@ -1,4 +1,4 @@
using Longbow.Tasks; using Longbow.Tasks;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using System; using System;
using System.Linq; using System.Linq;
@ -16,17 +16,18 @@ namespace Microsoft.Extensions.DependencyInjection
/// 添加示例后台任务 /// 添加示例后台任务
/// </summary> /// </summary>
/// <param name="services"></param> /// <param name="services"></param>
public static IServiceCollection AddDemoTask(this IServiceCollection services) public static IServiceCollection AddBootstrapAdminBackgroundTask(this IServiceCollection services)
{ {
services.AddHostedService<TaskBackgroundServices>(); services.AddTaskServices();
return services.AddTaskServices(); services.AddHostedService<BootstrapAdminBackgroundServices>();
return services;
} }
} }
/// <summary> /// <summary>
/// 后台任务服务类 /// 后台任务服务类
/// </summary> /// </summary>
internal class TaskBackgroundServices : BackgroundService internal class BootstrapAdminBackgroundServices : BackgroundService
{ {
/// <summary> /// <summary>
/// 运行任务 /// 运行任务