Browse Source

upgrade(abp): upgrade abp framework to 5.1.1

pull/464/head
cKey 4 years ago
parent
commit
30da8b8ca8
  1. 2
      apps/vue/src/views/task-management/background-jobs/components/BackgroundJobInfoTable.vue
  2. 6
      aspnet-core/Directory.Build.props
  3. 7
      aspnet-core/LINGYUN.MicroService.Startup.sln
  4. 2
      aspnet-core/common.props
  5. 2
      aspnet-core/modules/cli/LINGYUN.Abp.Cli/LINGYUN.Abp.Cli.csproj
  6. 8
      aspnet-core/modules/common/LINGYUN.Abp.BackgroundWorkers.Hangfire/LINGYUN/Abp/BackgroundWorkers/Hangfire/HangfireBackgroundWorkerManager.cs
  7. 3
      aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN.Abp.EventBus.CAP.xml
  8. 8
      aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN/Abp/EventBus/CAP/CAPDistributedEventBus.cs
  9. 3
      aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN.Abp.EventBus.CAP.xml
  10. 13
      aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/AbpNotificationModule.cs
  11. 4
      aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.Abstractions/LINGYUN/Abp/BackgroundTasks/JobEventData.cs
  12. 2
      aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.Abstractions/LINGYUN/Abp/BackgroundTasks/JobInfo.cs
  13. 171
      aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.Quartz/LINGYUN/Abp/BackgroundTasks/Quartz/QuartzJobListener.cs
  14. 4
      aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.Quartz/LINGYUN/Abp/BackgroundTasks/Quartz/QuartzKeyBuilder.cs
  15. 1
      aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/LINGYUN.Abp.BackgroundTasks.csproj
  16. 4
      aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/LINGYUN/Abp/BackgroundTasks/AbpBackgroundTasksModule.cs
  17. 4
      aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/LINGYUN/Abp/BackgroundTasks/BackgroundJobManager.cs
  18. 119
      aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/LINGYUN/Abp/BackgroundTasks/BackgroundWorkerAdapter.cs
  19. 55
      aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/LINGYUN/Abp/BackgroundTasks/BackgroundWorkerManager.cs
  20. 10
      aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/LINGYUN/Abp/BackgroundTasks/IBackgroundWorkerRunnable.cs
  21. 2
      aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/LINGYUN/Abp/BackgroundTasks/IJobStore.cs
  22. 6
      aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/LINGYUN/Abp/BackgroundTasks/Internal/DefaultBackgroundWorker.cs
  23. 2
      aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/LINGYUN/Abp/BackgroundTasks/Internal/InMemoryJobStore.cs
  24. 20
      aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/README.md
  25. 2
      aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application.Contracts/LINGYUN/Abp/TaskManagement/BackgroundJobInfoBatchInput.cs
  26. 2
      aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application.Contracts/LINGYUN/Abp/TaskManagement/BackgroundJobInfoDto.cs
  27. 2
      aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application.Contracts/LINGYUN/Abp/TaskManagement/BackgroundJobLogGetListInput.cs
  28. 12
      aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application.Contracts/LINGYUN/Abp/TaskManagement/IBackgroundJobInfoAppService.cs
  29. 19
      aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application/LINGYUN/Abp/TaskManagement/BackgroundJobInfoAppService.cs
  30. 1
      aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Domain.Shared/LINGYUN/Abp/TaskManagement/BackgroundJobLogConsts.cs
  31. 4
      aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Domain/LINGYUN/Abp/TaskManagement/BackgroundJobInfo.cs
  32. 2
      aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Domain/LINGYUN/Abp/TaskManagement/BackgroundJobLog.cs
  33. 2
      aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Domain/LINGYUN/Abp/TaskManagement/BackgroundJobStore.cs
  34. 2
      aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Domain/LINGYUN/Abp/TaskManagement/IBackgroundJobInfoRepository.cs
  35. 4
      aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Domain/LINGYUN/Abp/TaskManagement/IBackgroundJobLogRepository.cs
  36. 4
      aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.EntityFrameworkCore/LINGYUN/Abp/TaskManagement/EntityFrameworkCore/EfCoreBackgroundJobInfoRepository.cs
  37. 8
      aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.EntityFrameworkCore/LINGYUN/Abp/TaskManagement/EntityFrameworkCore/EfCoreBackgroundJobLogRepository.cs
  38. 3
      aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.EntityFrameworkCore/LINGYUN/Abp/TaskManagement/EntityFrameworkCore/TaskManagementDbContextModelCreatingExtensions.cs
  39. 16
      aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.HttpApi/LINGYUN/Abp/TaskManagement/BackgroundJobInfoController.cs
  40. 61
      aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/Program.cs
  41. 30
      aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/Startup.cs
  42. 61
      aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/Program.cs
  43. 30
      aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/Startup.cs
  44. 60
      aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/Program.cs
  45. 30
      aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/Startup.cs
  46. 60
      aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Program.cs
  47. 30
      aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Startup.cs
  48. 4
      aspnet-core/services/LY.MicroService.TaskManagement.HttpApi.Host/EventBus/Handlers/TenantSynchronizer.cs
  49. 202
      aspnet-core/services/LY.MicroService.TaskManagement.HttpApi.Host/Migrations/20220113113020_Change-Background-Job-Info-Key-To-String.Designer.cs
  50. 60
      aspnet-core/services/LY.MicroService.TaskManagement.HttpApi.Host/Migrations/20220113113020_Change-Background-Job-Info-Key-To-String.cs
  51. 11
      aspnet-core/services/LY.MicroService.TaskManagement.HttpApi.Host/Migrations/TaskManagementMigrationsDbContextModelSnapshot.cs
  52. 64
      aspnet-core/services/LY.MicroService.TaskManagement.HttpApi.Host/Program.cs
  53. 30
      aspnet-core/services/LY.MicroService.TaskManagement.HttpApi.Host/Startup.cs
  54. 2
      aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/Dockerfile
  55. 64
      aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/Program.cs
  56. 30
      aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/Startup.cs
  57. 60
      aspnet-core/services/LY.MicroService.identityServer.HttpApi.Host/Program.cs
  58. 30
      aspnet-core/services/LY.MicroService.identityServer.HttpApi.Host/Startup.cs
  59. 63
      aspnet-core/services/LY.MicroService.identityServer/Program.cs
  60. 32
      aspnet-core/services/LY.MicroService.identityServer/Startup.cs
  61. 2
      aspnet-core/services/LY.MicroService.identityServer/package.json
  62. 2
      common.props
  63. 4
      gateways/Directory.Build.props
  64. 2
      gateways/common.props

2
apps/vue/src/views/task-management/background-jobs/components/BackgroundJobInfoTable.vue

@ -192,7 +192,7 @@
content: L('MultipleSelectJobsWillBeDeletedMessage'),
okCancel: true,
onOk: () => {
deleteById(record).then(() => {
deleteById(record.id).then(() => {
reload();
});
},

6
aspnet-core/Directory.Build.props

@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<VoloAbpPackageVersion>5.0.0</VoloAbpPackageVersion>
<LINGYUNAbpPackageVersion>5.0.0</LINGYUNAbpPackageVersion>
<VoloAbpPackageVersion>5.1.1</VoloAbpPackageVersion>
<LINGYUNAbpPackageVersion>5.1.1</LINGYUNAbpPackageVersion>
<DaprPackageVersion>1.5.0</DaprPackageVersion>
<DistributedLockRedisPackageVersion>1.0.1</DistributedLockRedisPackageVersion>
<DotNetCoreCAPPackageVersion>5.2.0</DotNetCoreCAPPackageVersion>
@ -10,7 +10,7 @@
<TencentCloudSDKPackageVersion>3.0.434</TencentCloudSDKPackageVersion>
<AgileConfigClientPackageVersion>1.2.1.5</AgileConfigClientPackageVersion>
<HangfireMySqlStoragePackageVersion>2.0.3</HangfireMySqlStoragePackageVersion>
<HangfireMSSQLStoragePackageVersion>1.7.27</HangfireMSSQLStoragePackageVersion>
<HangfireMSSQLStoragePackageVersion>1.7.28</HangfireMSSQLStoragePackageVersion>
<NESTPackageVersion>7.15.1</NESTPackageVersion>
<QuartzNETPackageVersion>3.3.3</QuartzNETPackageVersion>
<StackExchangeRedisPackageVersion>2.0.593</StackExchangeRedisPackageVersion>

7
aspnet-core/LINGYUN.MicroService.Startup.sln

@ -33,6 +33,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "task-management", "task-man
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LY.MicroService.TaskManagement.HttpApi.Host", "services\LY.MicroService.TaskManagement.HttpApi.Host\LY.MicroService.TaskManagement.HttpApi.Host.csproj", "{EDE83705-EFEA-46DC-A8EE-68A5D8159B84}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LY.MicroService.WorkflowManagement.HttpApi.Host", "services\LY.MicroService.WorkflowManagement.HttpApi.Host\LY.MicroService.WorkflowManagement.HttpApi.Host.csproj", "{48F376EC-B951-4123-AF33-54217AD00B96}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -67,6 +69,10 @@ Global
{EDE83705-EFEA-46DC-A8EE-68A5D8159B84}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EDE83705-EFEA-46DC-A8EE-68A5D8159B84}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EDE83705-EFEA-46DC-A8EE-68A5D8159B84}.Release|Any CPU.Build.0 = Release|Any CPU
{48F376EC-B951-4123-AF33-54217AD00B96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{48F376EC-B951-4123-AF33-54217AD00B96}.Debug|Any CPU.Build.0 = Debug|Any CPU
{48F376EC-B951-4123-AF33-54217AD00B96}.Release|Any CPU.ActiveCfg = Release|Any CPU
{48F376EC-B951-4123-AF33-54217AD00B96}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -79,6 +85,7 @@ Global
{0DBBB371-B1FC-421E-A4FB-900B016AFE6A} = {A3275CEC-C5CB-4F22-875A-8270B5F4D698}
{03A07A13-D9F3-4E70-B4D2-57BA2CF1E8DB} = {099F0FD1-645D-4029-8149-46523AD34933}
{EDE83705-EFEA-46DC-A8EE-68A5D8159B84} = {3F453010-BA07-471D-87E5-B12346ED81EF}
{48F376EC-B951-4123-AF33-54217AD00B96} = {E47CDAF7-1046-4886-A0CB-ADF9650F8318}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A3905D9F-6EF7-4BFD-80B3-E0DD6AA82228}

2
aspnet-core/common.props

@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>5.0.0</Version>
<Version>5.1.1</Version>
<Authors>colin</Authors>
<NoWarn>$(NoWarn);CS1591;CS0436</NoWarn>
<PackageProjectUrl>https://github.com/colinin/abp-vue-admin-element-typescript/</PackageProjectUrl>

2
aspnet-core/modules/cli/LINGYUN.Abp.Cli/LINGYUN.Abp.Cli.csproj

@ -5,7 +5,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<Version>5.0.1</Version>
<Version>5.1.1</Version>
<Copyright>colin</Copyright>
<Description>Use LINGYUN.MicroService.Templates command line</Description>
<PackAsTool>true</PackAsTool>

8
aspnet-core/modules/common/LINGYUN.Abp.BackgroundWorkers.Hangfire/LINGYUN/Abp/BackgroundWorkers/Hangfire/HangfireBackgroundWorkerManager.cs

@ -20,7 +20,7 @@ namespace LINGYUN.Abp.BackgroundWorkers.Hangfire
ServiceProvider = serviceProvider;
}
public void Add(IBackgroundWorker worker)
public Task AddAsync(IBackgroundWorker worker)
{
var timer = worker.GetType()
.GetProperty("Timer", BindingFlags.NonPublic | BindingFlags.Instance)?
@ -28,7 +28,7 @@ namespace LINGYUN.Abp.BackgroundWorkers.Hangfire
if (timer == null)
{
return;
return Task.CompletedTask;
}
var period = timer.GetType()
@ -38,7 +38,7 @@ namespace LINGYUN.Abp.BackgroundWorkers.Hangfire
if (!period.HasValue)
{
return;
return Task.CompletedTask;
}
var adapterType = typeof(HangfireBackgroundWorkerAdapter<>).MakeGenericType(worker.GetType());
@ -48,6 +48,8 @@ namespace LINGYUN.Abp.BackgroundWorkers.Hangfire
recurringJobId: worker.GetType().FullName,
methodCall: () => workerAdapter.ExecuteAsync(),
cronExpression: CronGenerator.FormMilliseconds(period.Value));
return Task.CompletedTask;
}
public Task StartAsync(CancellationToken cancellationToken = default)

3
aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN.Abp.EventBus.CAP.xml

@ -209,7 +209,7 @@
取消令牌
</summary>
</member>
<member name="M:LINGYUN.Abp.EventBus.CAP.CAPDistributedEventBus.#ctor(Microsoft.Extensions.DependencyInjection.IServiceScopeFactory,Microsoft.Extensions.Options.IOptions{Volo.Abp.EventBus.Distributed.AbpDistributedEventBusOptions},DotNetCore.CAP.ICapPublisher,Volo.Abp.Users.ICurrentUser,Volo.Abp.Clients.ICurrentClient,Volo.Abp.MultiTenancy.ICurrentTenant,Volo.Abp.Json.IJsonSerializer,Volo.Abp.Uow.IUnitOfWorkManager,Volo.Abp.Guids.IGuidGenerator,Volo.Abp.Timing.IClock,Volo.Abp.Threading.ICancellationTokenProvider,LINGYUN.Abp.EventBus.CAP.ICustomDistributedEventSubscriber)">
<member name="M:LINGYUN.Abp.EventBus.CAP.CAPDistributedEventBus.#ctor(Microsoft.Extensions.DependencyInjection.IServiceScopeFactory,Microsoft.Extensions.Options.IOptions{Volo.Abp.EventBus.Distributed.AbpDistributedEventBusOptions},DotNetCore.CAP.ICapPublisher,Volo.Abp.Users.ICurrentUser,Volo.Abp.Clients.ICurrentClient,Volo.Abp.MultiTenancy.ICurrentTenant,Volo.Abp.Json.IJsonSerializer,Volo.Abp.Uow.IUnitOfWorkManager,Volo.Abp.Guids.IGuidGenerator,Volo.Abp.Timing.IClock,Volo.Abp.Threading.ICancellationTokenProvider,LINGYUN.Abp.EventBus.CAP.ICustomDistributedEventSubscriber,Volo.Abp.EventBus.IEventHandlerInvoker)">
<summary>
constructor
</summary>
@ -225,6 +225,7 @@
<param name="guidGenerator"></param>
<param name="clock"></param>
<param name="customDistributedEventSubscriber"></param>
<param name="eventHandlerInvoker"></param>
</member>
<member name="M:LINGYUN.Abp.EventBus.CAP.CAPDistributedEventBus.Subscribe(System.Type,Volo.Abp.EventBus.IEventHandlerFactory)">
<summary>

8
aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN/Abp/EventBus/CAP/CAPDistributedEventBus.cs

@ -76,6 +76,7 @@ namespace LINGYUN.Abp.EventBus.CAP
/// <param name="guidGenerator"></param>
/// <param name="clock"></param>
/// <param name="customDistributedEventSubscriber"></param>
/// <param name="eventHandlerInvoker"></param>
public CAPDistributedEventBus(IServiceScopeFactory serviceScopeFactory,
IOptions<AbpDistributedEventBusOptions> distributedEventBusOptions,
ICapPublisher capPublisher,
@ -87,14 +88,16 @@ namespace LINGYUN.Abp.EventBus.CAP
IGuidGenerator guidGenerator,
IClock clock,
ICancellationTokenProvider cancellationTokenProvider,
ICustomDistributedEventSubscriber customDistributedEventSubscriber)
ICustomDistributedEventSubscriber customDistributedEventSubscriber,
IEventHandlerInvoker eventHandlerInvoker)
: base(
serviceScopeFactory,
currentTenant,
unitOfWorkManager,
distributedEventBusOptions,
guidGenerator,
clock)
clock,
eventHandlerInvoker)
{
CapPublisher = capPublisher;
CurrentUser = currentUser;
@ -157,6 +160,7 @@ namespace LINGYUN.Abp.EventBus.CAP
var eventName = EventNameAttribute.GetNameOrDefault(eventType);
await PublishAsync(eventName, eventData);
}
/// <summary>
/// 获取事件处理器工厂列表
/// </summary>

3
aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN.Abp.EventBus.CAP.xml

@ -209,7 +209,7 @@
取消令牌
</summary>
</member>
<member name="M:LINGYUN.Abp.EventBus.CAP.CAPDistributedEventBus.#ctor(Microsoft.Extensions.DependencyInjection.IServiceScopeFactory,Microsoft.Extensions.Options.IOptions{Volo.Abp.EventBus.Distributed.AbpDistributedEventBusOptions},DotNetCore.CAP.ICapPublisher,Volo.Abp.Users.ICurrentUser,Volo.Abp.Clients.ICurrentClient,Volo.Abp.MultiTenancy.ICurrentTenant,Volo.Abp.Json.IJsonSerializer,Volo.Abp.Uow.IUnitOfWorkManager,Volo.Abp.Guids.IGuidGenerator,Volo.Abp.Timing.IClock,Volo.Abp.Threading.ICancellationTokenProvider,LINGYUN.Abp.EventBus.CAP.ICustomDistributedEventSubscriber)">
<member name="M:LINGYUN.Abp.EventBus.CAP.CAPDistributedEventBus.#ctor(Microsoft.Extensions.DependencyInjection.IServiceScopeFactory,Microsoft.Extensions.Options.IOptions{Volo.Abp.EventBus.Distributed.AbpDistributedEventBusOptions},DotNetCore.CAP.ICapPublisher,Volo.Abp.Users.ICurrentUser,Volo.Abp.Clients.ICurrentClient,Volo.Abp.MultiTenancy.ICurrentTenant,Volo.Abp.Json.IJsonSerializer,Volo.Abp.Uow.IUnitOfWorkManager,Volo.Abp.Guids.IGuidGenerator,Volo.Abp.Timing.IClock,Volo.Abp.Threading.ICancellationTokenProvider,LINGYUN.Abp.EventBus.CAP.ICustomDistributedEventSubscriber,Volo.Abp.EventBus.IEventHandlerInvoker)">
<summary>
constructor
</summary>
@ -225,6 +225,7 @@
<param name="guidGenerator"></param>
<param name="clock"></param>
<param name="customDistributedEventSubscriber"></param>
<param name="eventHandlerInvoker"></param>
</member>
<member name="M:LINGYUN.Abp.EventBus.CAP.CAPDistributedEventBus.Subscribe(System.Type,Volo.Abp.EventBus.IEventHandlerFactory)">
<summary>

13
aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/AbpNotificationModule.cs

@ -5,11 +5,13 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.BackgroundJobs;
using Volo.Abp.BackgroundWorkers;
using Volo.Abp.Json;
using Volo.Abp.Modularity;
using Volo.Abp.Threading;
namespace LINGYUN.Abp.Notifications
{
@ -28,14 +30,19 @@ namespace LINGYUN.Abp.Notifications
AutoAddDefinitionProviders(context.Services);
}
public override void OnPostApplicationInitialization(ApplicationInitializationContext context)
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
AsyncHelper.RunSync(() => OnApplicationInitializationAsync(context));
}
public override async Task OnApplicationInitializationAsync(ApplicationInitializationContext context)
{
var options = context.ServiceProvider.GetRequiredService<IOptions<AbpNotificationCleanupOptions>>().Value;
if (options.IsEnabled)
{
context.ServiceProvider
await context.ServiceProvider
.GetRequiredService<IBackgroundWorkerManager>()
.Add(
.AddAsync(
context.ServiceProvider
.GetRequiredService<NotificationCleanupBackgroundWorker>()
);

4
aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.Abstractions/LINGYUN/Abp/BackgroundTasks/JobEventData.cs

@ -19,7 +19,7 @@ public class JobEventData
/// <summary>
/// 任务标识
/// </summary>
public Guid Key { get; }
public string Key { get; }
/// <summary>
/// 任务状态
/// </summary>
@ -75,7 +75,7 @@ public class JobEventData
/// </summary>
public bool IsAbandoned { get; set; }
public JobEventData(
Guid key,
string key,
Type type,
string group,
string name,

2
aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.Abstractions/LINGYUN/Abp/BackgroundTasks/JobInfo.cs

@ -8,7 +8,7 @@ public class JobInfo
/// <summary>
/// 任务标识
/// </summary>
public Guid Id { get; set; }
public string Id { get; set; }
/// <summary>
/// 租户标识
/// </summary>

171
aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.Quartz/LINGYUN/Abp/BackgroundTasks/Quartz/QuartzJobListener.cs

@ -49,45 +49,46 @@ public class QuartzJobListener : JobListenerSupport, ISingletonDependency
public override async Task JobToBeExecuted(IJobExecutionContext context, CancellationToken cancellationToken = default)
{
var jobId = context.GetString(nameof(JobInfo.Id));
if (Guid.TryParse(jobId, out var jobUUId))
try
{
try
var jobId = context.GetString(nameof(JobInfo.Id));
if (jobId.IsNullOrWhiteSpace())
{
var jobEventList = EventProvider.GetAll();
if (!jobEventList.Any())
{
return;
}
using var scope = ServiceProvider.CreateScope();
var jobEventData = new JobEventData(
jobUUId,
context.JobDetail.JobType,
context.JobDetail.Key.Group,
context.JobDetail.Key.Name)
{
Result = context.Result?.ToString()
};
var eventContext = new JobEventContext(
scope.ServiceProvider,
jobEventData);
var index = 0;
var taskList = new Task[jobEventList.Count];
foreach (var jobEvent in jobEventList)
{
taskList[index] = jobEvent.OnJobBeforeExecuted(eventContext);
index++;
}
await Task.WhenAll(taskList);
return;
}
catch (Exception ex)
var jobEventList = EventProvider.GetAll();
if (!jobEventList.Any())
{
Logger.LogError($"The event before the task execution is abnormal:{ex}");
return;
}
using var scope = ServiceProvider.CreateScope();
var jobEventData = new JobEventData(
jobId,
context.JobDetail.JobType,
context.JobDetail.Key.Group,
context.JobDetail.Key.Name)
{
Result = context.Result?.ToString()
};
var eventContext = new JobEventContext(
scope.ServiceProvider,
jobEventData);
var index = 0;
var taskList = new Task[jobEventList.Count];
foreach (var jobEvent in jobEventList)
{
taskList[index] = jobEvent.OnJobBeforeExecuted(eventContext);
index++;
}
await Task.WhenAll(taskList);
}
catch (Exception ex)
{
Logger.LogError($"The event before the task execution is abnormal:{ex}");
}
}
@ -95,6 +96,12 @@ public class QuartzJobListener : JobListenerSupport, ISingletonDependency
{
try
{
var jobId = context.GetString(nameof(JobInfo.Id));
if (jobId.IsNullOrWhiteSpace())
{
return;
}
var jobEventList = EventProvider.GetAll();
if (!jobEventList.Any())
{
@ -102,58 +109,54 @@ public class QuartzJobListener : JobListenerSupport, ISingletonDependency
}
using var scope = ServiceProvider.CreateScope();
var jobId = context.GetString(nameof(JobInfo.Id));
if (Guid.TryParse(jobId, out var jobUUId))
var jobType = context.JobDetail.JobType;
if (jobType.IsGenericType)
{
jobType = jobType.GetGenericArguments()[0];
}
var jobEventData = new JobEventData(
jobId,
jobType,
context.JobDetail.Key.Group,
context.JobDetail.Key.Name,
jobException)
{
Status = JobStatus.Running
};
if (context.Trigger is ISimpleTrigger simpleTrigger)
{
var jobType = context.JobDetail.JobType;
if (jobType.IsGenericType)
{
jobType = jobType.GetGenericArguments()[0];
}
var jobEventData = new JobEventData(
jobUUId,
jobType,
context.JobDetail.Key.Group,
context.JobDetail.Key.Name,
jobException)
{
Status = JobStatus.Running
};
if (context.Trigger is ISimpleTrigger simpleTrigger)
{
jobEventData.Triggered = simpleTrigger.TimesTriggered;
jobEventData.RepeatCount = simpleTrigger.RepeatCount;
}
jobEventData.Description = context.JobDetail.Description;
jobEventData.RunTime = Clock.Now;
jobEventData.LastRunTime = context.PreviousFireTimeUtc?.LocalDateTime;
jobEventData.NextRunTime = context.NextFireTimeUtc?.LocalDateTime;
if (context.Result != null)
{
jobEventData.Result = context.Result?.ToString();
}
var tenantIdString = context.GetString(nameof(IMultiTenant.TenantId));
if (Guid.TryParse(tenantIdString, out var tenantId))
{
jobEventData.TenantId = tenantId;
}
var eventContext = new JobEventContext(
scope.ServiceProvider,
jobEventData);
var index = 0;
var taskList = new Task[jobEventList.Count];
foreach (var jobEvent in jobEventList)
{
taskList[index] = jobEvent.OnJobAfterExecuted(eventContext);
index++;
}
await Task.WhenAll(taskList);
jobEventData.Triggered = simpleTrigger.TimesTriggered;
jobEventData.RepeatCount = simpleTrigger.RepeatCount;
}
jobEventData.Description = context.JobDetail.Description;
jobEventData.RunTime = Clock.Now;
jobEventData.LastRunTime = context.PreviousFireTimeUtc?.LocalDateTime;
jobEventData.NextRunTime = context.NextFireTimeUtc?.LocalDateTime;
if (context.Result != null)
{
jobEventData.Result = context.Result?.ToString();
}
var tenantIdString = context.GetString(nameof(IMultiTenant.TenantId));
if (Guid.TryParse(tenantIdString, out var tenantId))
{
jobEventData.TenantId = tenantId;
}
var eventContext = new JobEventContext(
scope.ServiceProvider,
jobEventData);
var index = 0;
var taskList = new Task[jobEventList.Count];
foreach (var jobEvent in jobEventList)
{
taskList[index] = jobEvent.OnJobAfterExecuted(eventContext);
index++;
}
await Task.WhenAll(taskList);
}
catch (Exception ex)
{

4
aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.Quartz/LINGYUN/Abp/BackgroundTasks/Quartz/QuartzKeyBuilder.cs

@ -15,7 +15,7 @@ public class QuartzKeyBuilder : IQuartzKeyBuilder, ISingletonDependency
public JobKey CreateJobKey(JobInfo jobInfo)
{
var name = jobInfo.Id.ToString();
var name = jobInfo.Id;
var group = CurrentTenant.IsAvailable
? $"{CurrentTenant.Id}:{jobInfo.Group}"
: $"Default:{jobInfo.Group}";
@ -25,7 +25,7 @@ public class QuartzKeyBuilder : IQuartzKeyBuilder, ISingletonDependency
public TriggerKey CreateTriggerKey(JobInfo jobInfo)
{
var name = jobInfo.Id.ToString();
var name = jobInfo.Id;
var group = CurrentTenant.IsAvailable
? $"{CurrentTenant.Id}:{jobInfo.Group}"
: $"Default:{jobInfo.Group}";

1
aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/LINGYUN.Abp.BackgroundTasks.csproj

@ -11,6 +11,7 @@
<ItemGroup>
<PackageReference Include="Volo.Abp.Auditing" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Volo.Abp.BackgroundJobs.Abstractions" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Volo.Abp.BackgroundWorkers" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Volo.Abp.Caching" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Volo.Abp.DistributedLocking.Abstractions" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Volo.Abp.Guids" Version="$(VoloAbpPackageVersion)" />

4
aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/LINGYUN/Abp/BackgroundTasks/AbpBackgroundTasksModule.cs

@ -3,6 +3,7 @@ using LINGYUN.Abp.BackgroundTasks.Localization;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Auditing;
using Volo.Abp.BackgroundJobs;
using Volo.Abp.BackgroundWorkers;
using Volo.Abp.DistributedLocking;
using Volo.Abp.Guids;
using Volo.Abp.Localization;
@ -15,6 +16,7 @@ namespace LINGYUN.Abp.BackgroundTasks;
[DependsOn(typeof(AbpLocalizationModule))]
[DependsOn(typeof(AbpBackgroundTasksAbstractionsModule))]
[DependsOn(typeof(AbpBackgroundJobsAbstractionsModule))]
[DependsOn(typeof(AbpBackgroundWorkersModule))]
[DependsOn(typeof(AbpDistributedLockingAbstractionsModule))]
[DependsOn(typeof(AbpGuidsModule))]
public class AbpBackgroundTasksModule : AbpModule
@ -22,6 +24,8 @@ public class AbpBackgroundTasksModule : AbpModule
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddTransient(typeof(BackgroundJobAdapter<>));
context.Services.AddSingleton(typeof(BackgroundWorkerAdapter<>));
context.Services.AddHostedService<DefaultBackgroundWorker>();
Configure<AbpVirtualFileSystemOptions>(options =>

4
aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/LINGYUN/Abp/BackgroundTasks/BackgroundJobManager.cs

@ -60,7 +60,7 @@ public class BackgroundJobManager : IBackgroundJobManager, ITransientDependency
};
var jobInfo = new JobInfo
{
Id = jobId,
Id = jobId.ToString(),
TenantId = CurrentTenant.Id,
Name = jobId.ToString(),
Group = "BackgroundJobs",
@ -82,7 +82,7 @@ public class BackgroundJobManager : IBackgroundJobManager, ITransientDependency
// 手动入队
await JobScheduler.QueueAsync(jobInfo);
return jobId.ToString();
return jobInfo.Id;
}
private JobPriority ConverForm(BackgroundJobPriority priority)

119
aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/LINGYUN/Abp/BackgroundTasks/BackgroundWorkerAdapter.cs

@ -0,0 +1,119 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Threading.Tasks;
using Volo.Abp.BackgroundWorkers;
using Volo.Abp.DynamicProxy;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Threading;
using Volo.Abp.Timing;
namespace LINGYUN.Abp.BackgroundTasks;
public class BackgroundWorkerAdapter<TWorker> : BackgroundWorkerBase, IBackgroundWorkerRunnable
where TWorker : IBackgroundWorker
{
protected IClock Clock => LazyServiceProvider.LazyGetRequiredService<IClock>();
protected IJobStore JobStore => LazyServiceProvider.LazyGetRequiredService<IJobStore>();
protected IJobScheduler JobScheduler => LazyServiceProvider.LazyGetRequiredService<IJobScheduler>();
protected ICurrentTenant CurrentTenant => LazyServiceProvider.LazyGetRequiredService<ICurrentTenant>();
private readonly MethodInfo _doWorkAsyncMethod;
private readonly MethodInfo _doWorkMethod;
public BackgroundWorkerAdapter()
{
_doWorkAsyncMethod = typeof(TWorker).GetMethod("DoWorkAsync", BindingFlags.Instance | BindingFlags.NonPublic);
_doWorkMethod = typeof(TWorker).GetMethod("DoWork", BindingFlags.Instance | BindingFlags.NonPublic);
}
#nullable enable
public JobInfo? BuildWorker(IBackgroundWorker worker)
{
int? period;
var workerType = ProxyHelper.GetUnProxiedType(worker);
if (worker is AsyncPeriodicBackgroundWorkerBase or PeriodicBackgroundWorkerBase)
{
if (typeof(TWorker) != workerType)
{
throw new ArgumentException($"{nameof(worker)} type is different from the generic type");
}
var timer = workerType.GetProperty("Timer", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(worker);
if (timer == null)
{
return null;
}
if (worker is AsyncPeriodicBackgroundWorkerBase)
{
period = ((AbpAsyncTimer)timer)?.Period;
}
else
{
period = ((AbpTimer)timer)?.Period;
}
}
else
{
return null;
}
if (period == null)
{
return null;
}
var jobArgs = new Dictionary<string, object>
{
{ "JobType", workerType.AssemblyQualifiedName },
};
return new JobInfo
{
Id = workerType.FullName,
TenantId = CurrentTenant.Id,
Name = workerType.FullName,
Group = "BackgroundWorkers",
Priority = JobPriority.Normal,
BeginTime = Clock.Now,
Args = jobArgs,
Description = "From the framework background workers",
JobType = JobType.Persistent,
Interval = period.Value / 1000,
MaxCount = 0,
// TODO: 可配置
MaxTryCount = 10,
CreationTime = Clock.Now,
// 确保不会被轮询入队
Status = JobStatus.None,
Type = typeof(BackgroundWorkerAdapter<TWorker>).AssemblyQualifiedName,
};
}
#nullable disable
public async Task ExecuteAsync(JobRunnableContext context)
{
var worker = (IBackgroundWorker)ServiceProvider.GetService(typeof(TWorker));
var workerContext = new PeriodicBackgroundWorkerContext(ServiceProvider);
switch (worker)
{
case AsyncPeriodicBackgroundWorkerBase asyncWorker:
{
if (_doWorkAsyncMethod != null)
{
await(Task) _doWorkAsyncMethod.Invoke(asyncWorker, new object[] { workerContext });
}
break;
}
case PeriodicBackgroundWorkerBase syncWorker:
{
_doWorkMethod?.Invoke(syncWorker, new object[] { workerContext });
break;
}
}
}
}

55
aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/LINGYUN/Abp/BackgroundTasks/BackgroundWorkerManager.cs

@ -0,0 +1,55 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.BackgroundWorkers;
using Volo.Abp.DependencyInjection;
using Volo.Abp.DynamicProxy;
namespace LINGYUN.Abp.BackgroundTasks;
[Dependency(ReplaceServices = true)]
public class BackgroundWorkerManager : IBackgroundWorkerManager, ISingletonDependency
{
protected IJobStore JobStore { get; }
protected IJobScheduler JobScheduler { get; }
protected IServiceProvider ServiceProvider { get; }
public BackgroundWorkerManager(
IJobStore jobStore,
IJobScheduler jobScheduler,
IServiceProvider serviceProvider)
{
JobStore = jobStore;
JobScheduler = jobScheduler;
ServiceProvider = serviceProvider;
}
public async Task AddAsync(IBackgroundWorker worker)
{
var adapterType = typeof(BackgroundWorkerAdapter<>).MakeGenericType(ProxyHelper.GetUnProxiedType(worker));
var workerAdapter = ServiceProvider.GetService(adapterType) as IBackgroundWorkerRunnable;
var jobInfo = workerAdapter?.BuildWorker(worker);
if (jobInfo == null)
{
return;
}
// 存储状态
await JobStore.StoreAsync(jobInfo);
// 手动入队
await JobScheduler.QueueAsync(jobInfo);
}
public Task StartAsync(CancellationToken cancellationToken = default)
{
return Task.CompletedTask;
}
public Task StopAsync(CancellationToken cancellationToken = default)
{
return Task.CompletedTask;
}
}

10
aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/LINGYUN/Abp/BackgroundTasks/IBackgroundWorkerRunnable.cs

@ -0,0 +1,10 @@
using Volo.Abp.BackgroundWorkers;
namespace LINGYUN.Abp.BackgroundTasks;
public interface IBackgroundWorkerRunnable : IJobRunnable
{
#nullable enable
JobInfo? BuildWorker(IBackgroundWorker worker);
#nullable disable
}

2
aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/LINGYUN/Abp/BackgroundTasks/IJobStore.cs

@ -14,7 +14,7 @@ public interface IJobStore
Task<List<JobInfo>> GetAllPeriodTasksAsync(
CancellationToken cancellationToken = default);
Task<JobInfo> FindAsync(Guid jobId);
Task<JobInfo> FindAsync(string jobId);
Task StoreAsync(JobInfo jobInfo);

6
aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/LINGYUN/Abp/BackgroundTasks/Internal/DefaultBackgroundWorker.cs

@ -55,7 +55,7 @@ internal class DefaultBackgroundWorker : BackgroundService
{
return new JobInfo
{
Id = Guid.Parse("8F50C5D9-5691-4B99-A52B-CABD91D93C89"),
Id = "KeepAlive",
Name = nameof(BackgroundKeepAliveJob),
Group = "KeepAlive",
Description = "Add periodic tasks",
@ -75,7 +75,7 @@ internal class DefaultBackgroundWorker : BackgroundService
{
return new JobInfo
{
Id = Guid.Parse("C51152E9-F0B8-4252-8352-283BE46083CC"),
Id = "Polling",
Name = nameof(BackgroundPollingJob),
Group = "Polling",
Description = "Polling tasks to be executed",
@ -95,7 +95,7 @@ internal class DefaultBackgroundWorker : BackgroundService
{
return new JobInfo
{
Id = Guid.Parse("AAAF8783-FA06-4CF9-BDCA-11140FB2478F"),
Id = "Cleaning",
Name = nameof(BackgroundCleaningJob),
Group = "Cleaning",
Description = "Cleaning tasks to be executed",

2
aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/LINGYUN/Abp/BackgroundTasks/Internal/InMemoryJobStore.cs

@ -41,7 +41,7 @@ internal class InMemoryJobStore : IJobStore, ISingletonDependency
return Task.FromResult(jobs);
}
public Task<JobInfo> FindAsync(Guid jobId)
public Task<JobInfo> FindAsync(string jobId)
{
var job = _memoryJobStore.FirstOrDefault(x => x.Id.Equals(jobId));
return Task.FromResult(job);

20
aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/README.md

@ -97,6 +97,11 @@ public class DemoClass
},
BackgroundJobPriority.High,
TimeSpan.FromSeconds(10));
// 同样可以把框架后台工作者添加到作业调度器中, 不需要更改使用习惯
var backgroundWorkManager = ServiceProvider.GetRequiredService<IBackgroundWorkerManager>();
// 每20秒控制台输出
await backgroundWorkManager.AddAsync(ServiceProvider.GetRequiredService<ConsoleWorker>());
}
}
@ -115,4 +120,19 @@ public class SmsJob : AsyncBackgroundJob<SmsJobArgs>, ITransientDependency
return Task.CompletedTask;
}
}
public class ConsoleWorker : AsyncPeriodicBackgroundWorkerBase, ISingletonDependency
{
public ConsoleWorker(AbpAsyncTimer timer, IServiceScopeFactory serviceScopeFactory)
: base(timer, serviceScopeFactory)
{
timer.Period = 20000;
}
protected override Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext)
{
Console.WriteLine($"[{DateTime.Now:yyyy-MM-dd HH:mm:ss}] - ConsoleWorker Do Wrok.");
return Task.CompletedTask;
}
}
```

2
aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application.Contracts/LINGYUN/Abp/TaskManagement/BackgroundJobInfoBatchInput.cs

@ -5,5 +5,5 @@ namespace LINGYUN.Abp.TaskManagement;
public class BackgroundJobInfoBatchInput
{
public List<Guid> JobIds { get; set; } = new List<Guid>();
public List<string> JobIds { get; set; } = new List<string>();
}

2
aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application.Contracts/LINGYUN/Abp/TaskManagement/BackgroundJobInfoDto.cs

@ -6,7 +6,7 @@ using Volo.Abp.Domain.Entities;
namespace LINGYUN.Abp.TaskManagement;
public class BackgroundJobInfoDto : ExtensibleAuditedEntityDto<Guid>, IHasConcurrencyStamp
public class BackgroundJobInfoDto : ExtensibleAuditedEntityDto<string>, IHasConcurrencyStamp
{
public string ConcurrencyStamp { get; set; }
/// <summary>

2
aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application.Contracts/LINGYUN/Abp/TaskManagement/BackgroundJobLogGetListInput.cs

@ -5,7 +5,7 @@ namespace LINGYUN.Abp.TaskManagement;
public class BackgroundJobLogGetListInput : PagedAndSortedResultRequestDto
{
public Guid? JobId { get; set; }
public string JobId { get; set; }
/// <summary>
/// 其他过滤条件
/// </summary>

12
aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application.Contracts/LINGYUN/Abp/TaskManagement/IBackgroundJobInfoAppService.cs

@ -7,20 +7,20 @@ namespace LINGYUN.Abp.TaskManagement;
public interface IBackgroundJobInfoAppService :
ICrudAppService<
BackgroundJobInfoDto,
Guid,
string,
BackgroundJobInfoGetListInput,
BackgroundJobInfoCreateDto,
BackgroundJobInfoUpdateDto>
{
Task TriggerAsync(Guid id);
Task TriggerAsync(string id);
Task PauseAsync(Guid id);
Task PauseAsync(string id);
Task ResumeAsync(Guid id);
Task ResumeAsync(string id);
Task StopAsync(Guid id);
Task StopAsync(string id);
Task StartAsync(Guid id);
Task StartAsync(string id);
Task BulkDeleteAsync(BackgroundJobInfoBatchInput input);

19
aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application/LINGYUN/Abp/TaskManagement/BackgroundJobInfoAppService.cs

@ -35,8 +35,9 @@ public class BackgroundJobInfoAppService : TaskManagementApplicationService, IBa
.WithData("Name", input.Name);
}
var jobId = GuidGenerator.Create();
var backgroundJobInfo = new BackgroundJobInfo(
GuidGenerator.Create(),
jobId.ToString(),
input.Name,
input.Group,
input.Type,
@ -61,14 +62,14 @@ public class BackgroundJobInfoAppService : TaskManagementApplicationService, IBa
}
[Authorize(TaskManagementPermissions.BackgroundJobs.Delete)]
public virtual async Task DeleteAsync(Guid id)
public virtual async Task DeleteAsync(string id)
{
var backgroundJobInfo = await BackgroundJobInfoRepository.GetAsync(id);
await BackgroundJobManager.DeleteAsync(backgroundJobInfo);
}
public virtual async Task<BackgroundJobInfoDto> GetAsync(Guid id)
public virtual async Task<BackgroundJobInfoDto> GetAsync(string id)
{
var backgroundJobInfo = await BackgroundJobInfoRepository.GetAsync(id);
@ -103,7 +104,7 @@ public class BackgroundJobInfoAppService : TaskManagementApplicationService, IBa
}
[Authorize(TaskManagementPermissions.BackgroundJobs.Pause)]
public virtual async Task PauseAsync(Guid id)
public virtual async Task PauseAsync(string id)
{
var backgroundJobInfo = await BackgroundJobInfoRepository.GetAsync(id);
@ -111,7 +112,7 @@ public class BackgroundJobInfoAppService : TaskManagementApplicationService, IBa
}
[Authorize(TaskManagementPermissions.BackgroundJobs.Resume)]
public virtual async Task ResumeAsync(Guid id)
public virtual async Task ResumeAsync(string id)
{
var backgroundJobInfo = await BackgroundJobInfoRepository.GetAsync(id);
@ -119,7 +120,7 @@ public class BackgroundJobInfoAppService : TaskManagementApplicationService, IBa
}
[Authorize(TaskManagementPermissions.BackgroundJobs.Trigger)]
public virtual async Task TriggerAsync(Guid id)
public virtual async Task TriggerAsync(string id)
{
var backgroundJobInfo = await BackgroundJobInfoRepository.GetAsync(id);
@ -127,7 +128,7 @@ public class BackgroundJobInfoAppService : TaskManagementApplicationService, IBa
}
[Authorize(TaskManagementPermissions.BackgroundJobs.Stop)]
public virtual async Task StopAsync(Guid id)
public virtual async Task StopAsync(string id)
{
var backgroundJobInfo = await BackgroundJobInfoRepository.GetAsync(id);
@ -135,7 +136,7 @@ public class BackgroundJobInfoAppService : TaskManagementApplicationService, IBa
}
[Authorize(TaskManagementPermissions.BackgroundJobs.Start)]
public virtual async Task StartAsync(Guid id)
public virtual async Task StartAsync(string id)
{
var backgroundJobInfo = await BackgroundJobInfoRepository.GetAsync(id);
@ -143,7 +144,7 @@ public class BackgroundJobInfoAppService : TaskManagementApplicationService, IBa
}
[Authorize(TaskManagementPermissions.BackgroundJobs.Update)]
public virtual async Task<BackgroundJobInfoDto> UpdateAsync(Guid id, BackgroundJobInfoUpdateDto input)
public virtual async Task<BackgroundJobInfoDto> UpdateAsync(string id, BackgroundJobInfoUpdateDto input)
{
var backgroundJobInfo = await BackgroundJobInfoRepository.GetAsync(id);

1
aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Domain.Shared/LINGYUN/Abp/TaskManagement/BackgroundJobLogConsts.cs

@ -2,6 +2,7 @@
public static class BackgroundJobLogConsts
{
public static int MaxJobIdLength { get; set; } = 255;
public static int MaxMessageLength { get; set; } = 1000;
public static int MaxExceptionLength { get; set; } = 2000;
}

4
aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Domain/LINGYUN/Abp/TaskManagement/BackgroundJobInfo.cs

@ -8,7 +8,7 @@ using Volo.Abp.MultiTenancy;
namespace LINGYUN.Abp.TaskManagement;
public class BackgroundJobInfo : AuditedAggregateRoot<Guid>, IMultiTenant
public class BackgroundJobInfo : AuditedAggregateRoot<string>, IMultiTenant
{
public virtual Guid? TenantId { get; protected set; }
/// <summary>
@ -107,7 +107,7 @@ public class BackgroundJobInfo : AuditedAggregateRoot<Guid>, IMultiTenant
protected BackgroundJobInfo() { }
public BackgroundJobInfo(
Guid id,
string id,
string name,
string group,
string type,

2
aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Domain/LINGYUN/Abp/TaskManagement/BackgroundJobLog.cs

@ -8,7 +8,7 @@ namespace LINGYUN.Abp.TaskManagement;
public class BackgroundJobLog : Entity<long>, IMultiTenant
{
public virtual Guid? TenantId { get; protected set; }
public virtual Guid? JobId { get; set; }
public virtual string JobId { get; set; }
public virtual string JobName { get; protected set; }
public virtual string JobGroup { get; protected set; }
public virtual string JobType { get; protected set; }

2
aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Domain/LINGYUN/Abp/TaskManagement/BackgroundJobStore.cs

@ -44,7 +44,7 @@ public class BackgroundJobStore : IJobStore, ITransientDependency
return ObjectMapper.Map<List<BackgroundJobInfo>, List<JobInfo>>(jobInfos);
}
public async virtual Task<JobInfo> FindAsync(Guid jobId)
public async virtual Task<JobInfo> FindAsync(string jobId)
{
var jobInfo = await JobInfoRepository.FindAsync(jobId);

2
aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Domain/LINGYUN/Abp/TaskManagement/IBackgroundJobInfoRepository.cs

@ -6,7 +6,7 @@ using Volo.Abp.Domain.Repositories;
namespace LINGYUN.Abp.TaskManagement;
public interface IBackgroundJobInfoRepository : IRepository<BackgroundJobInfo, Guid>
public interface IBackgroundJobInfoRepository : IRepository<BackgroundJobInfo, string>
{
Task<bool> CheckNameAsync(
string group,

4
aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Domain/LINGYUN/Abp/TaskManagement/IBackgroundJobLogRepository.cs

@ -17,7 +17,7 @@ public interface IBackgroundJobLogRepository : IRepository<BackgroundJobLog, lon
/// <returns></returns>
Task<int> GetCountAsync(
BackgroundJobLogFilter filter,
Guid? jobId = null,
string jobId = null,
CancellationToken cancellationToken = default);
/// <summary>
/// 获取过滤后的任务日志列表
@ -31,7 +31,7 @@ public interface IBackgroundJobLogRepository : IRepository<BackgroundJobLog, lon
/// <returns></returns>
Task<List<BackgroundJobLog>> GetListAsync(
BackgroundJobLogFilter filter,
Guid? jobId = null,
string jobId = null,
string sorting = nameof(BackgroundJobLog.RunTime),
int maxResultCount = 10,
int skipCount = 0,

4
aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.EntityFrameworkCore/LINGYUN/Abp/TaskManagement/EntityFrameworkCore/EfCoreBackgroundJobInfoRepository.cs

@ -13,7 +13,7 @@ using Volo.Abp.Timing;
namespace LINGYUN.Abp.TaskManagement.EntityFrameworkCore;
public class EfCoreBackgroundJobInfoRepository :
EfCoreRepository<TaskManagementDbContext, BackgroundJobInfo, Guid>,
EfCoreRepository<TaskManagementDbContext, BackgroundJobInfo, string>,
IBackgroundJobInfoRepository
{
protected IClock Clock { get; }
@ -60,6 +60,7 @@ public class EfCoreBackgroundJobInfoRepository :
.Where(x => x.JobType == JobType.Period && status.Contains(x.Status))
.Where(x => (x.MaxCount == 0 || x.TriggerCount < x.MaxCount) || (x.MaxTryCount == 0 || x.TryCount < x.MaxTryCount))
.OrderByDescending(x => x.Priority)
.AsNoTracking()
.ToListAsync(GetCancellationToken(cancellationToken));
}
@ -120,6 +121,7 @@ public class EfCoreBackgroundJobInfoRepository :
.ThenBy(x => x.TryCount)
.ThenBy(x => x.NextRunTime)
.Take(maxResultCount)
.AsNoTracking()
.ToListAsync(GetCancellationToken(cancellationToken));
}
}

8
aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.EntityFrameworkCore/LINGYUN/Abp/TaskManagement/EntityFrameworkCore/EfCoreBackgroundJobLogRepository.cs

@ -22,11 +22,11 @@ public class EfCoreBackgroundJobLogRepository :
public virtual async Task<int> GetCountAsync(
BackgroundJobLogFilter filter,
Guid? jobId = null,
string jobId = null,
CancellationToken cancellationToken = default)
{
return await (await GetDbSetAsync())
.WhereIf(jobId.HasValue, x => x.JobId.Equals(jobId))
.WhereIf(!jobId.IsNullOrWhiteSpace(), x => x.JobId.Equals(jobId))
.WhereIf(!filter.Type.IsNullOrWhiteSpace(), x => x.JobType.Contains(filter.Type))
.WhereIf(!filter.Group.IsNullOrWhiteSpace(), x => x.JobGroup.Equals(filter.Group))
.WhereIf(!filter.Name.IsNullOrWhiteSpace(), x => x.JobName.Equals(filter.Name))
@ -40,14 +40,14 @@ public class EfCoreBackgroundJobLogRepository :
public virtual async Task<List<BackgroundJobLog>> GetListAsync(
BackgroundJobLogFilter filter,
Guid? jobId = null,
string jobId = null,
string sorting = nameof(BackgroundJobLog.RunTime),
int maxResultCount = 10,
int skipCount = 0,
CancellationToken cancellationToken = default)
{
return await (await GetDbSetAsync())
.WhereIf(jobId.HasValue, x => x.JobId.Equals(jobId))
.WhereIf(!jobId.IsNullOrWhiteSpace(), x => x.JobId.Equals(jobId))
.WhereIf(!filter.Type.IsNullOrWhiteSpace(), x => x.JobType.Contains(filter.Type))
.WhereIf(!filter.Group.IsNullOrWhiteSpace(), x => x.JobGroup.Equals(filter.Group))
.WhereIf(!filter.Name.IsNullOrWhiteSpace(), x => x.JobName.Equals(filter.Name))

3
aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.EntityFrameworkCore/LINGYUN/Abp/TaskManagement/EntityFrameworkCore/TaskManagementDbContextModelCreatingExtensions.cs

@ -60,6 +60,9 @@ public static class TaskManagementDbContextModelCreatingExtensions
{
b.ToTable(options.TablePrefix + "BackgroundJobLogs", options.Schema);
b.Property(p => p.JobId)
.HasColumnName(nameof(BackgroundJobLog.JobId))
.HasMaxLength(BackgroundJobLogConsts.MaxJobIdLength);
b.Property(p => p.JobName)
.HasColumnName(nameof(BackgroundJobLog.JobName))
.HasMaxLength(BackgroundJobInfoConsts.MaxNameLength);

16
aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.HttpApi/LINGYUN/Abp/TaskManagement/BackgroundJobInfoController.cs

@ -32,14 +32,14 @@ public class BackgroundJobInfoController : TaskManagementController, IBackground
[HttpDelete]
[Route("{id}")]
[Authorize(TaskManagementPermissions.BackgroundJobs.Delete)]
public Task DeleteAsync(Guid id)
public Task DeleteAsync(string id)
{
return BackgroundJobInfoAppService.DeleteAsync(id);
}
[HttpGet]
[Route("{id}")]
public Task<BackgroundJobInfoDto> GetAsync(Guid id)
public Task<BackgroundJobInfoDto> GetAsync(string id)
{
return BackgroundJobInfoAppService.GetAsync(id);
}
@ -53,7 +53,7 @@ public class BackgroundJobInfoController : TaskManagementController, IBackground
[HttpPut]
[Route("{id}/pause")]
[Authorize(TaskManagementPermissions.BackgroundJobs.Pause)]
public Task PauseAsync(Guid id)
public Task PauseAsync(string id)
{
return BackgroundJobInfoAppService.PauseAsync(id);
}
@ -61,7 +61,7 @@ public class BackgroundJobInfoController : TaskManagementController, IBackground
[HttpPut]
[Route("{id}/resume")]
[Authorize(TaskManagementPermissions.BackgroundJobs.Resume)]
public Task ResumeAsync(Guid id)
public Task ResumeAsync(string id)
{
return BackgroundJobInfoAppService.ResumeAsync(id);
}
@ -69,7 +69,7 @@ public class BackgroundJobInfoController : TaskManagementController, IBackground
[HttpPut]
[Route("{id}/trigger")]
[Authorize(TaskManagementPermissions.BackgroundJobs.Trigger)]
public Task TriggerAsync(Guid id)
public Task TriggerAsync(string id)
{
return BackgroundJobInfoAppService.TriggerAsync(id);
}
@ -77,7 +77,7 @@ public class BackgroundJobInfoController : TaskManagementController, IBackground
[HttpPut]
[Route("{id}/stop")]
[Authorize(TaskManagementPermissions.BackgroundJobs.Stop)]
public Task StopAsync(Guid id)
public Task StopAsync(string id)
{
return BackgroundJobInfoAppService.StopAsync(id);
}
@ -85,7 +85,7 @@ public class BackgroundJobInfoController : TaskManagementController, IBackground
[HttpPut]
[Route("{id}")]
[Authorize(TaskManagementPermissions.BackgroundJobs.Update)]
public Task<BackgroundJobInfoDto> UpdateAsync(Guid id, BackgroundJobInfoUpdateDto input)
public Task<BackgroundJobInfoDto> UpdateAsync(string id, BackgroundJobInfoUpdateDto input)
{
return BackgroundJobInfoAppService.UpdateAsync(id, input);
}
@ -93,7 +93,7 @@ public class BackgroundJobInfoController : TaskManagementController, IBackground
[HttpPut]
[Route("{id}/start")]
[Authorize(TaskManagementPermissions.BackgroundJobs.Start)]
public Task StartAsync(Guid id)
public Task StartAsync(string id)
{
return BackgroundJobInfoAppService.StartAsync(id);
}

61
aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/Program.cs

@ -1,19 +1,54 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Serilog;
using System;
using System.IO;
using System.Threading.Tasks;
using Volo.Abp.IO;
using Volo.Abp.Modularity.PlugIns;
namespace LY.MicroService.BackendAdmin;
public class Program
{
public static int Main(string[] args)
public async static Task<int> Main(string[] args)
{
try
{
Log.Information("Starting BackendAdmin.Host.");
CreateHostBuilder(args).Build().Run();
var builder = WebApplication.CreateBuilder(args);
builder.Host.AddAppSettingsSecretsJson()
.UseAutofac()
.ConfigureAppConfiguration((context, config) =>
{
var configuration = config.Build();
if (configuration.GetSection("AgileConfig").Exists())
{
config.AddAgileConfig(new AgileConfig.Client.ConfigClient(configuration));
}
})
.UseSerilog((context, provider, config) =>
{
config.ReadFrom.Configuration(context.Configuration);
});
await builder.AddApplicationAsync<BackendAdminHttpApiHostModule>(options =>
{
// 搜索 Modules 目录下所有文件作为插件
// 取消显示引用所有其他项目的模块,改为通过插件的形式引用
var pluginFolder = Path.Combine(
Directory.GetCurrentDirectory(), "Modules");
DirectoryHelper.CreateIfNotExists(pluginFolder);
options.PlugInSources.AddFolder(
pluginFolder,
SearchOption.AllDirectories);
});
var app = builder.Build();
await app.InitializeApplicationAsync();
await app.RunAsync();
return 0;
}
catch (Exception ex)
@ -26,24 +61,4 @@ public class Program
Log.CloseAndFlush();
}
}
internal static IHostBuilder CreateHostBuilder(string[] args) =>
Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
})
.ConfigureAppConfiguration((context, config) =>
{
var configuration = config.Build();
if (configuration.GetSection("AgileConfig").Exists())
{
config.AddAgileConfig(new AgileConfig.Client.ConfigClient(configuration));
}
})
.UseSerilog((context, provider, config) =>
{
config.ReadFrom.Configuration(context.Configuration);
})
.UseAutofac();
}

30
aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/Startup.cs

@ -1,30 +0,0 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using System.IO;
using Volo.Abp.IO;
using Volo.Abp.Modularity.PlugIns;
namespace LY.MicroService.BackendAdmin;
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddApplication<BackendAdminHttpApiHostModule>(options =>
{
// 搜索 Modules 目录下所有文件作为插件
// 取消显示引用所有其他项目的模块,改为通过插件的形式引用
var pluginFolder = Path.Combine(
Directory.GetCurrentDirectory(), "Modules");
DirectoryHelper.CreateIfNotExists(pluginFolder);
options.PlugInSources.AddFolder(
pluginFolder,
SearchOption.AllDirectories);
});
}
public void Configure(IApplicationBuilder app)
{
app.InitializeApplication();
}
}

61
aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/Program.cs

@ -1,21 +1,54 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Serilog;
using System;
using System.IO;
using System.Threading.Tasks;
using Volo.Abp.IO;
using Volo.Abp.Modularity.PlugIns;
namespace LY.MicroService.LocalizationManagement;
public class Program
{
public static int Main(string[] args)
public async static Task<int> Main(string[] args)
{
try
{
var hostBuilder = CreateHostBuilder(args).Build();
Log.Information("Starting LocalizationManagement.Host.");
hostBuilder.Run();
Log.Information("Starting LocalizationManagement.HttpApi.Host.");
var builder = WebApplication.CreateBuilder(args);
builder.Host.AddAppSettingsSecretsJson()
.UseAutofac()
.ConfigureAppConfiguration((context, config) =>
{
var configuration = config.Build();
if (configuration.GetSection("AgileConfig").Exists())
{
config.AddAgileConfig(new AgileConfig.Client.ConfigClient(configuration));
}
})
.UseSerilog((context, provider, config) =>
{
config.ReadFrom.Configuration(context.Configuration);
});
await builder.AddApplicationAsync<LocalizationManagementHttpApiHostModule>(options =>
{
// 搜索 Modules 目录下所有文件作为插件
// 取消显示引用所有其他项目的模块,改为通过插件的形式引用
var pluginFolder = Path.Combine(
Directory.GetCurrentDirectory(), "Modules");
DirectoryHelper.CreateIfNotExists(pluginFolder);
options.PlugInSources.AddFolder(
pluginFolder,
SearchOption.AllDirectories);
});
var app = builder.Build();
await app.InitializeApplicationAsync();
await app.RunAsync();
return 0;
}
catch (Exception ex)
@ -28,24 +61,4 @@ public class Program
Log.CloseAndFlush();
}
}
internal static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
})
.ConfigureAppConfiguration((context, config) =>
{
var configuration = config.Build();
if (configuration.GetSection("AgileConfig").Exists())
{
config.AddAgileConfig(new AgileConfig.Client.ConfigClient(configuration));
}
})
.UseSerilog((context, provider, config) =>
{
config.ReadFrom.Configuration(context.Configuration);
})
.UseAutofac();
}

30
aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/Startup.cs

@ -1,30 +0,0 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using System.IO;
using Volo.Abp.IO;
using Volo.Abp.Modularity.PlugIns;
namespace LY.MicroService.LocalizationManagement;
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddApplication<LocalizationManagementHttpApiHostModule>(options =>
{
// 搜索 Modules 目录下所有文件作为插件
// 取消显示引用所有其他项目的模块,改为通过插件的形式引用
var pluginFolder = Path.Combine(
Directory.GetCurrentDirectory(), "Modules");
DirectoryHelper.CreateIfNotExists(pluginFolder);
options.PlugInSources.AddFolder(
pluginFolder,
SearchOption.AllDirectories);
});
}
public void Configure(IApplicationBuilder app)
{
app.InitializeApplication();
}
}

60
aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/Program.cs

@ -1,22 +1,54 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Serilog;
using System;
using System.IO;
using System.Threading.Tasks;
using Volo.Abp.IO;
using Volo.Abp.Modularity.PlugIns;
namespace LY.MicroService.PlatformManagement;
public class Program
{
public static int Main(string[] args)
public async static Task<int> Main(string[] args)
{
try
{
var hostBuilder = CreateHostBuilder(args).Build();
Log.Information("Starting Platform.Host.");
hostBuilder.Run();
Log.Information("Starting PlatformManagement.HttpApi.Host.");
var builder = WebApplication.CreateBuilder(args);
builder.Host.AddAppSettingsSecretsJson()
.UseAutofac()
.ConfigureAppConfiguration((context, config) =>
{
var configuration = config.Build();
if (configuration.GetSection("AgileConfig").Exists())
{
config.AddAgileConfig(new AgileConfig.Client.ConfigClient(configuration));
}
})
.UseSerilog((context, provider, config) =>
{
config.ReadFrom.Configuration(context.Configuration);
});
await builder.AddApplicationAsync<PlatformManagementHttpApiHostModule>(options =>
{
// 搜索 Modules 目录下所有文件作为插件
// 取消显示引用所有其他项目的模块,改为通过插件的形式引用
var pluginFolder = Path.Combine(
Directory.GetCurrentDirectory(), "Modules");
DirectoryHelper.CreateIfNotExists(pluginFolder);
options.PlugInSources.AddFolder(
pluginFolder,
SearchOption.AllDirectories);
});
var app = builder.Build();
await app.InitializeApplicationAsync();
await app.RunAsync();
return 0;
}
catch (Exception ex)
@ -29,24 +61,4 @@ public class Program
Log.CloseAndFlush();
}
}
internal static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
})
.ConfigureAppConfiguration((context, config) =>
{
var configuration = config.Build();
if (configuration.GetSection("AgileConfig").Exists())
{
config.AddAgileConfig(new AgileConfig.Client.ConfigClient(configuration));
}
})
.UseSerilog((context, provider, config) =>
{
config.ReadFrom.Configuration(context.Configuration);
})
.UseAutofac();
}

30
aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/Startup.cs

@ -1,30 +0,0 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using System.IO;
using Volo.Abp.IO;
using Volo.Abp.Modularity.PlugIns;
namespace LY.MicroService.PlatformManagement;
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddApplication<PlatformManagementHttpApiHostModule>(options =>
{
// 搜索 Modules 目录下所有文件作为插件
// 取消显示引用所有其他项目的模块,改为通过插件的形式引用
var pluginFolder = Path.Combine(
Directory.GetCurrentDirectory(), "Modules");
DirectoryHelper.CreateIfNotExists(pluginFolder);
options.PlugInSources.AddFolder(
pluginFolder,
SearchOption.AllDirectories);
});
}
public void Configure(IApplicationBuilder app)
{
app.InitializeApplication();
}
}

60
aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Program.cs

@ -1,22 +1,54 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Serilog;
using System;
using System.IO;
using System.Threading.Tasks;
using Volo.Abp.IO;
using Volo.Abp.Modularity.PlugIns;
namespace LY.MicroService.RealtimeMessage;
public class Program
{
public static int Main(string[] args)
public async static Task<int> Main(string[] args)
{
try
{
var hostBuilder = CreateHostBuilder(args).Build();
Log.Information("Starting MessageService.Host.");
hostBuilder.Run();
Log.Information("Starting RealtimeMessage.HttpApi.Host.");
var builder = WebApplication.CreateBuilder(args);
builder.Host.AddAppSettingsSecretsJson()
.UseAutofac()
.ConfigureAppConfiguration((context, config) =>
{
var configuration = config.Build();
if (configuration.GetSection("AgileConfig").Exists())
{
config.AddAgileConfig(new AgileConfig.Client.ConfigClient(configuration));
}
})
.UseSerilog((context, provider, config) =>
{
config.ReadFrom.Configuration(context.Configuration);
});
await builder.AddApplicationAsync<RealtimeMessageHttpApiHostModule>(options =>
{
// 搜索 Modules 目录下所有文件作为插件
// 取消显示引用所有其他项目的模块,改为通过插件的形式引用
var pluginFolder = Path.Combine(
Directory.GetCurrentDirectory(), "Modules");
DirectoryHelper.CreateIfNotExists(pluginFolder);
options.PlugInSources.AddFolder(
pluginFolder,
SearchOption.AllDirectories);
});
var app = builder.Build();
await app.InitializeApplicationAsync();
await app.RunAsync();
return 0;
}
catch (Exception ex)
@ -29,24 +61,4 @@ public class Program
Log.CloseAndFlush();
}
}
internal static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
})
.ConfigureAppConfiguration((context, config) =>
{
var configuration = config.Build();
if (configuration.GetSection("AgileConfig").Exists())
{
config.AddAgileConfig(new AgileConfig.Client.ConfigClient(configuration));
}
})
.UseSerilog((context, provider, config) =>
{
config.ReadFrom.Configuration(context.Configuration);
})
.UseAutofac();
}

30
aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Startup.cs

@ -1,30 +0,0 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using System.IO;
using Volo.Abp.IO;
using Volo.Abp.Modularity.PlugIns;
namespace LY.MicroService.RealtimeMessage;
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddApplication<RealtimeMessageHttpApiHostModule>(options =>
{
// 搜索 Modules 目录下所有文件作为插件
// 取消显示引用所有其他项目的模块,改为通过插件的形式引用
var pluginFolder = Path.Combine(
Directory.GetCurrentDirectory(), "Modules");
DirectoryHelper.CreateIfNotExists(pluginFolder);
options.PlugInSources.AddFolder(
pluginFolder,
SearchOption.AllDirectories);
});
}
public void Configure(IApplicationBuilder app)
{
app.InitializeApplication();
}
}

4
aspnet-core/services/LY.MicroService.TaskManagement.HttpApi.Host/EventBus/Handlers/TenantSynchronizer.cs

@ -100,7 +100,7 @@ namespace LY.MicroService.TaskManagement.EventBus.Handlers
{
return new JobInfo
{
Id = tenantId,
Id = tenantId.ToString(),
Name = nameof(BackgroundPollingJob),
Group = "Polling",
Description = "Polling tasks to be executed",
@ -121,7 +121,7 @@ namespace LY.MicroService.TaskManagement.EventBus.Handlers
{
return new JobInfo
{
Id = tenantId,
Id = tenantId.ToString(),
Name = nameof(BackgroundCleaningJob),
Group = "Cleaning",
Description = "Cleaning tasks to be executed",

202
aspnet-core/services/LY.MicroService.TaskManagement.HttpApi.Host/Migrations/20220113113020_Change-Background-Job-Info-Key-To-String.Designer.cs

@ -0,0 +1,202 @@
// <auto-generated />
using System;
using LY.MicroService.TaskManagement.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Volo.Abp.EntityFrameworkCore;
#nullable disable
namespace LY.MicroService.TaskManagement.Migrations
{
[DbContext(typeof(TaskManagementMigrationsDbContext))]
[Migration("20220113113020_Change-Background-Job-Info-Key-To-String")]
partial class ChangeBackgroundJobInfoKeyToString
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql)
.HasAnnotation("ProductVersion", "6.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("LINGYUN.Abp.TaskManagement.BackgroundJobInfo", b =>
{
b.Property<string>("Id")
.HasColumnType("varchar(255)");
b.Property<string>("Args")
.HasColumnType("longtext")
.HasColumnName("Args");
b.Property<DateTime>("BeginTime")
.HasColumnType("datetime(6)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)")
.HasColumnName("CreatorId");
b.Property<string>("Cron")
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasColumnName("Cron");
b.Property<string>("Description")
.HasMaxLength(255)
.HasColumnType("varchar(255)")
.HasColumnName("Description");
b.Property<DateTime?>("EndTime")
.HasColumnType("datetime(6)");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
b.Property<string>("Group")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasColumnName("Group");
b.Property<int>("Interval")
.HasColumnType("int");
b.Property<bool>("IsAbandoned")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsEnabled")
.HasColumnType("tinyint(1)");
b.Property<int>("JobType")
.HasColumnType("int");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("char(36)")
.HasColumnName("LastModifierId");
b.Property<DateTime?>("LastRunTime")
.HasColumnType("datetime(6)");
b.Property<int>("LockTimeOut")
.HasColumnType("int");
b.Property<int>("MaxCount")
.HasColumnType("int");
b.Property<int>("MaxTryCount")
.HasColumnType("int");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("varchar(100)")
.HasColumnName("Name");
b.Property<DateTime?>("NextRunTime")
.HasColumnType("datetime(6)");
b.Property<int>("Priority")
.HasColumnType("int");
b.Property<string>("Result")
.HasMaxLength(1000)
.HasColumnType("varchar(1000)")
.HasColumnName("Result");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<Guid?>("TenantId")
.HasColumnType("char(36)")
.HasColumnName("TenantId");
b.Property<int>("TriggerCount")
.HasColumnType("int");
b.Property<int>("TryCount")
.HasColumnType("int");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(1000)
.HasColumnType("varchar(1000)")
.HasColumnName("Type");
b.HasKey("Id");
b.HasIndex("Name", "Group");
b.ToTable("TK_BackgroundJobs", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.TaskManagement.BackgroundJobLog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
b.Property<string>("Exception")
.HasMaxLength(2000)
.HasColumnType("varchar(2000)")
.HasColumnName("Exception");
b.Property<string>("JobGroup")
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasColumnName("JobGroup");
b.Property<string>("JobId")
.HasMaxLength(255)
.HasColumnType("varchar(255)")
.HasColumnName("JobId");
b.Property<string>("JobName")
.HasMaxLength(100)
.HasColumnType("varchar(100)")
.HasColumnName("JobName");
b.Property<string>("JobType")
.HasMaxLength(1000)
.HasColumnType("varchar(1000)")
.HasColumnName("JobType");
b.Property<string>("Message")
.HasMaxLength(1000)
.HasColumnType("varchar(1000)")
.HasColumnName("Message");
b.Property<DateTime>("RunTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("TenantId")
.HasColumnType("char(36)")
.HasColumnName("TenantId");
b.HasKey("Id");
b.HasIndex("JobGroup", "JobName");
b.ToTable("TK_BackgroundJobLogs", (string)null);
});
#pragma warning restore 612, 618
}
}
}

60
aspnet-core/services/LY.MicroService.TaskManagement.HttpApi.Host/Migrations/20220113113020_Change-Background-Job-Info-Key-To-String.cs

@ -0,0 +1,60 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LY.MicroService.TaskManagement.Migrations
{
public partial class ChangeBackgroundJobInfoKeyToString : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Id",
table: "TK_BackgroundJobs",
type: "varchar(255)",
nullable: false,
oldClrType: typeof(Guid),
oldType: "char(36)")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AlterColumn<string>(
name: "JobId",
table: "TK_BackgroundJobLogs",
type: "varchar(255)",
maxLength: 255,
nullable: true,
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<Guid>(
name: "Id",
table: "TK_BackgroundJobs",
type: "char(36)",
nullable: false,
collation: "ascii_general_ci",
oldClrType: typeof(string),
oldType: "varchar(255)")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<Guid>(
name: "JobId",
table: "TK_BackgroundJobLogs",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci",
oldClrType: typeof(string),
oldType: "varchar(255)",
oldMaxLength: 255,
oldNullable: true)
.OldAnnotation("MySql:CharSet", "utf8mb4");
}
}
}

11
aspnet-core/services/LY.MicroService.TaskManagement.HttpApi.Host/Migrations/TaskManagementMigrationsDbContextModelSnapshot.cs

@ -23,9 +23,8 @@ namespace LY.MicroService.TaskManagement.Migrations
modelBuilder.Entity("LINGYUN.Abp.TaskManagement.BackgroundJobInfo", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("Id")
.HasColumnType("varchar(255)");
b.Property<string>("Args")
.HasColumnType("longtext")
@ -162,8 +161,10 @@ namespace LY.MicroService.TaskManagement.Migrations
.HasColumnType("varchar(50)")
.HasColumnName("JobGroup");
b.Property<Guid?>("JobId")
.HasColumnType("char(36)");
b.Property<string>("JobId")
.HasMaxLength(255)
.HasColumnType("varchar(255)")
.HasColumnName("JobId");
b.Property<string>("JobName")
.HasMaxLength(100)

64
aspnet-core/services/LY.MicroService.TaskManagement.HttpApi.Host/Program.cs

@ -1,19 +1,53 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Serilog;
using System.IO;
using System.Threading.Tasks;
using Volo.Abp.IO;
using Volo.Abp.Modularity.PlugIns;
namespace LY.MicroService.TaskManagement;
public class Program
{
public static int Main(string[] args)
public async static Task<int> Main(string[] args)
{
try
{
var host = CreateHostBuilder(args).Build();
Log.Information("Starting web host.");
host.Run();
Log.Information("Starting TaskManagement.HttpApi.Host.");
var builder = WebApplication.CreateBuilder(args);
builder.Host.AddAppSettingsSecretsJson()
.UseAutofac()
.ConfigureAppConfiguration((context, config) =>
{
var configuration = config.Build();
if (configuration.GetSection("AgileConfig").Exists())
{
config.AddAgileConfig(new AgileConfig.Client.ConfigClient(configuration));
}
})
.UseSerilog((context, provider, config) =>
{
config.ReadFrom.Configuration(context.Configuration);
});
await builder.AddApplicationAsync<TaskManagementHttpApiHostModule>(options =>
{
// 搜索 Modules 目录下所有文件作为插件
// 取消显示引用所有其他项目的模块,改为通过插件的形式引用
var pluginFolder = Path.Combine(
Directory.GetCurrentDirectory(), "Modules");
DirectoryHelper.CreateIfNotExists(pluginFolder);
options.PlugInSources.AddFolder(
pluginFolder,
SearchOption.AllDirectories);
});
var app = builder.Build();
await app.InitializeApplicationAsync();
await app.RunAsync();
return 0;
}
finally
@ -21,24 +55,4 @@ public class Program
Log.CloseAndFlush();
}
}
internal static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
})
.ConfigureAppConfiguration((context, config) =>
{
var configuration = config.Build();
if (configuration.GetSection("AgileConfig").Exists())
{
config.AddAgileConfig(new AgileConfig.Client.ConfigClient(configuration));
}
})
.UseSerilog((context, config) =>
{
config.ReadFrom.Configuration(context.Configuration);
})
.UseAutofac();
}

30
aspnet-core/services/LY.MicroService.TaskManagement.HttpApi.Host/Startup.cs

@ -1,30 +0,0 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using System.IO;
using Volo.Abp.IO;
using Volo.Abp.Modularity.PlugIns;
namespace LY.MicroService.TaskManagement;
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddApplication<TaskManagementHttpApiHostModule>(options =>
{
// 搜索 Modules 目录下所有文件作为插件
// 取消显示引用所有其他项目的模块,改为通过插件的形式引用
var pluginFolder = Path.Combine(
Directory.GetCurrentDirectory(), "Modules");
DirectoryHelper.CreateIfNotExists(pluginFolder);
options.PlugInSources.AddFolder(
pluginFolder,
SearchOption.AllDirectories);
});
}
public void Configure(IApplicationBuilder app)
{
app.InitializeApplication();
}
}

2
aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/Dockerfile

@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/aspnet:5.0
FROM mcr.microsoft.com/dotnet/aspnet:6.0
LABEL maintainer="colin.in@foxmail.com"
WORKDIR /app

64
aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/Program.cs

@ -1,19 +1,53 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Serilog;
using System.IO;
using System.Threading.Tasks;
using Volo.Abp.IO;
using Volo.Abp.Modularity.PlugIns;
namespace LY.MicroService.WorkflowManagement;
public class Program
{
public static int Main(string[] args)
public async static Task<int> Main(string[] args)
{
try
{
var host = CreateHostBuilder(args).Build();
Log.Information("Starting web host.");
host.Run();
Log.Information("Starting WorkflowManagement.HttpApi.Host.");
var builder = WebApplication.CreateBuilder(args);
builder.Host.AddAppSettingsSecretsJson()
.UseAutofac()
.ConfigureAppConfiguration((context, config) =>
{
var configuration = config.Build();
if (configuration.GetSection("AgileConfig").Exists())
{
config.AddAgileConfig(new AgileConfig.Client.ConfigClient(configuration));
}
})
.UseSerilog((context, provider, config) =>
{
config.ReadFrom.Configuration(context.Configuration);
});
await builder.AddApplicationAsync<WorkflowManagementHttpApiHostModule>(options =>
{
// 搜索 Modules 目录下所有文件作为插件
// 取消显示引用所有其他项目的模块,改为通过插件的形式引用
var pluginFolder = Path.Combine(
Directory.GetCurrentDirectory(), "Modules");
DirectoryHelper.CreateIfNotExists(pluginFolder);
options.PlugInSources.AddFolder(
pluginFolder,
SearchOption.AllDirectories);
});
var app = builder.Build();
await app.InitializeApplicationAsync();
await app.RunAsync();
return 0;
}
finally
@ -21,24 +55,4 @@ public class Program
Log.CloseAndFlush();
}
}
internal static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
})
.ConfigureAppConfiguration((context, config) =>
{
var configuration = config.Build();
if (configuration.GetSection("AgileConfig").Exists())
{
config.AddAgileConfig(new AgileConfig.Client.ConfigClient(configuration));
}
})
.UseSerilog((context, config) =>
{
config.ReadFrom.Configuration(context.Configuration);
})
.UseAutofac();
}

30
aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/Startup.cs

@ -1,30 +0,0 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using System.IO;
using Volo.Abp.IO;
using Volo.Abp.Modularity.PlugIns;
namespace LY.MicroService.WorkflowManagement;
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddApplication<WorkflowManagementHttpApiHostModule>(options =>
{
// 搜索 Modules 目录下所有文件作为插件
// 取消显示引用所有其他项目的模块,改为通过插件的形式引用
var pluginFolder = Path.Combine(
Directory.GetCurrentDirectory(), "Modules");
DirectoryHelper.CreateIfNotExists(pluginFolder);
options.PlugInSources.AddFolder(
pluginFolder,
SearchOption.AllDirectories);
});
}
public void Configure(IApplicationBuilder app)
{
app.InitializeApplication();
}
}

60
aspnet-core/services/LY.MicroService.identityServer.HttpApi.Host/Program.cs

@ -1,22 +1,54 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Serilog;
using System;
using System.IO;
using System.Threading.Tasks;
using Volo.Abp.IO;
using Volo.Abp.Modularity.PlugIns;
namespace LY.MicroService.IdentityServer;
public class Program
{
public static int Main(string[] args)
public async static Task<int> Main(string[] args)
{
try
{
var hostBuilder = CreateHostBuilder(args).Build();
Log.Information("Starting IdentityServer4Admin.Host.");
hostBuilder.Run();
Log.Information("Starting IdentityServer.HttpApi.Host.");
var builder = WebApplication.CreateBuilder(args);
builder.Host.AddAppSettingsSecretsJson()
.UseAutofac()
.ConfigureAppConfiguration((context, config) =>
{
var configuration = config.Build();
if (configuration.GetSection("AgileConfig").Exists())
{
config.AddAgileConfig(new AgileConfig.Client.ConfigClient(configuration));
}
})
.UseSerilog((context, provider, config) =>
{
config.ReadFrom.Configuration(context.Configuration);
});
await builder.AddApplicationAsync<IdentityServerHttpApiHostModule>(options =>
{
// 搜索 Modules 目录下所有文件作为插件
// 取消显示引用所有其他项目的模块,改为通过插件的形式引用
var pluginFolder = Path.Combine(
Directory.GetCurrentDirectory(), "Modules");
DirectoryHelper.CreateIfNotExists(pluginFolder);
options.PlugInSources.AddFolder(
pluginFolder,
SearchOption.AllDirectories);
});
var app = builder.Build();
await app.InitializeApplicationAsync();
await app.RunAsync();
return 0;
}
catch (Exception ex)
@ -29,24 +61,4 @@ public class Program
Log.CloseAndFlush();
}
}
internal static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
})
.ConfigureAppConfiguration((context, config) =>
{
var configuration = config.Build();
if (configuration.GetSection("AgileConfig").Exists())
{
config.AddAgileConfig(new AgileConfig.Client.ConfigClient(configuration));
}
})
.UseSerilog((context, provider, config) =>
{
config.ReadFrom.Configuration(context.Configuration);
})
.UseAutofac();
}

30
aspnet-core/services/LY.MicroService.identityServer.HttpApi.Host/Startup.cs

@ -1,30 +0,0 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using System.IO;
using Volo.Abp.IO;
using Volo.Abp.Modularity.PlugIns;
namespace LY.MicroService.IdentityServer;
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddApplication<IdentityServerHttpApiHostModule>(options =>
{
// 搜索 Modules 目录下所有文件作为插件
// 取消显示引用所有其他项目的模块,改为通过插件的形式引用
var pluginFolder = Path.Combine(
Directory.GetCurrentDirectory(), "Modules");
DirectoryHelper.CreateIfNotExists(pluginFolder);
options.PlugInSources.AddFolder(
pluginFolder,
SearchOption.AllDirectories);
});
}
public void Configure(IApplicationBuilder app)
{
app.InitializeApplication();
}
}

63
aspnet-core/services/LY.MicroService.identityServer/Program.cs

@ -1,19 +1,54 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Serilog;
using System;
using System.IO;
using System.Threading.Tasks;
using Volo.Abp.IO;
using Volo.Abp.Modularity.PlugIns;
namespace LY.MicroService.IdentityServer;
public class Program
{
public static int Main(string[] args)
public async static Task<int> Main(string[] args)
{
try
{
Log.Information("Starting AuthServer.Host.");
CreateHostBuilder(args).Build().Run();
Log.Information("Starting IdentityServer.");
var builder = WebApplication.CreateBuilder(args);
builder.Host.AddAppSettingsSecretsJson()
.UseAutofac()
.ConfigureAppConfiguration((context, config) =>
{
var configuration = config.Build();
if (configuration.GetSection("AgileConfig").Exists())
{
config.AddAgileConfig(new AgileConfig.Client.ConfigClient(configuration));
}
})
.UseSerilog((context, provider, config) =>
{
config.ReadFrom.Configuration(context.Configuration);
});
await builder.AddApplicationAsync<IdentityServerModule>(options =>
{
// 搜索 Modules 目录下所有文件作为插件
// 取消显示引用所有其他项目的模块,改为通过插件的形式引用
var pluginFolder = Path.Combine(
Directory.GetCurrentDirectory(), "Modules");
DirectoryHelper.CreateIfNotExists(pluginFolder);
options.PlugInSources.AddFolder(
pluginFolder,
SearchOption.AllDirectories);
});
var app = builder.Build();
await app.InitializeApplicationAsync();
await app.RunAsync();
return 0;
}
catch (Exception ex)
@ -26,25 +61,5 @@ public class Program
Log.CloseAndFlush();
}
}
internal static IHostBuilder CreateHostBuilder(string[] args) =>
Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
})
.ConfigureAppConfiguration((context, config) =>
{
var configuration = config.Build();
if (configuration.GetSection("AgileConfig").Exists())
{
config.AddAgileConfig(new AgileConfig.Client.ConfigClient(configuration));
}
})
.UseSerilog((context, provider, config) =>
{
config.ReadFrom.Configuration(context.Configuration);
})
.UseAutofac();
}

32
aspnet-core/services/LY.MicroService.identityServer/Startup.cs

@ -1,32 +0,0 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System.IO;
using Volo.Abp.IO;
using Volo.Abp.Modularity.PlugIns;
namespace LY.MicroService.IdentityServer;
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddApplication<IdentityServerModule>(options =>
{
// 搜索 Modules 目录下所有文件作为插件
// 取消显示引用所有其他项目的模块,改为通过插件的形式引用
var pluginFolder = Path.Combine(
Directory.GetCurrentDirectory(), "Modules");
DirectoryHelper.CreateIfNotExists(pluginFolder);
options.PlugInSources.AddFolder(
pluginFolder,
SearchOption.AllDirectories);
});
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
{
app.InitializeApplication();
}
}

2
aspnet-core/services/LY.MicroService.identityServer/package.json

@ -3,6 +3,6 @@
"name": "my-app-identityserver",
"private": true,
"dependencies": {
"@abp/aspnetcore.mvc.ui.theme.basic": "^5.0.0-rc.1"
"@abp/aspnetcore.mvc.ui.theme.basic": "5.1.1"
}
}

2
common.props

@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>5.0.0</Version>
<Version>5.1.1</Version>
<Authors>LINGYUN</Authors>
<NoWarn>$(NoWarn);CS1591;CS0436</NoWarn>
<PackageProjectUrl>https://github.com/colinin/abp-vue-admin-element-typescript/</PackageProjectUrl>

4
gateways/Directory.Build.props

@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<VoloAbpPackageVersion>5.0.0</VoloAbpPackageVersion>
<LINGYUNAbpPackageVersion>5.0.0</LINGYUNAbpPackageVersion>
<VoloAbpPackageVersion>5.1.1</VoloAbpPackageVersion>
<LINGYUNAbpPackageVersion>5.1.1</LINGYUNAbpPackageVersion>
<DaprPackageVersion>1.5.0</DaprPackageVersion>
<DotNetCoreCAPPackageVersion>5.2.0</DotNetCoreCAPPackageVersion>
<AliyunSDKPackageVersion>1.5.10</AliyunSDKPackageVersion>

2
gateways/common.props

@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>5.0.0</Version>
<Version>5.1.1</Version>
<NoWarn>$(NoWarn);CS1591;CS0436</NoWarn>
</PropertyGroup>
</Project>
Loading…
Cancel
Save