Browse Source
Merge pull request #470 from colinin/fix-pre-configure
fix: IServiceCollection.ExecutePreConfiguredActions extension should be in the service before starting
pull/474/head
yx lin
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with
45 additions and
23 deletions
-
aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN/Abp/EventBus/CAP/AbpCAPEventBusModule.cs
-
aspnet-core/modules/common/LINGYUN.Abp.Hangfire.Dashboard/LINGYUN/Abp/Hangfire/Dashboard/AbpHangfireDashboardModule.cs
-
aspnet-core/modules/common/LINGYUN.Abp.Localization.Dynamic/LINGYUN/Abp/Localization/Dynamic/DynamicLocalizationInitializeService.cs
-
aspnet-core/modules/common/LINGYUN.Abp.Notifications.Sms/LINGYUN/Abp/Notifications/Sms/AbpNotificationsSmsModule.cs
-
aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/AbpNotificationModule.cs
-
aspnet-core/modules/oss-management/LINGYUN.Abp.BlobStoring.OssManagement/README.md
-
aspnet-core/modules/wechat/LINGYUN.Abp.Notifications.WeChat.MiniProgram/LINGYUN/Abp/Notifications/WeChat/MiniProgram/AbpNotificationsWeChatMiniProgramModule.cs
-
aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore/LINGYUN/Abp/WorkflowCore/AbpWorkflowCoreModule.cs
-
aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/WorkflowManagementHttpApiHostModule.Configure.cs
-
build/modules.dependencies.json
|
|
|
@ -1,4 +1,5 @@ |
|
|
|
using Microsoft.Extensions.Configuration; |
|
|
|
using DotNetCore.CAP; |
|
|
|
using Microsoft.Extensions.Configuration; |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
using Volo.Abp.EventBus; |
|
|
|
using Volo.Abp.Modularity; |
|
|
|
@ -23,13 +24,16 @@ namespace LINGYUN.Abp.EventBus.CAP |
|
|
|
|
|
|
|
context.Services.AddTransient<IFailedThresholdCallbackNotifier, FailedThresholdCallbackNotifier>(); |
|
|
|
|
|
|
|
var preActions = context.Services.GetPreConfigureActions<CapOptions>(); |
|
|
|
|
|
|
|
context.Services.AddCAPEventBus(options => |
|
|
|
{ |
|
|
|
// 取消默认的五分钟高频清理
|
|
|
|
// options.CollectorCleaningInterval = 360_0000;
|
|
|
|
|
|
|
|
configuration.GetSection("CAP:EventBus").Bind(options); |
|
|
|
context.Services.ExecutePreConfiguredActions(options); |
|
|
|
preActions.Configure(options); |
|
|
|
|
|
|
|
if (options.FailedThresholdCallback == null) |
|
|
|
{ |
|
|
|
options.FailedThresholdCallback = async (failed) => |
|
|
|
|
|
|
|
@ -1,4 +1,5 @@ |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
using Hangfire; |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
using Volo.Abp.Authorization; |
|
|
|
using Volo.Abp.Hangfire; |
|
|
|
using Volo.Abp.Modularity; |
|
|
|
@ -12,10 +13,13 @@ namespace LINGYUN.Abp.Hangfire.Dashboard |
|
|
|
{ |
|
|
|
public override void ConfigureServices(ServiceConfigurationContext context) |
|
|
|
{ |
|
|
|
var preActions = context.Services.GetPreConfigureActions<DashboardOptions>(); |
|
|
|
context.Services.AddTransient(serviceProvider => |
|
|
|
{ |
|
|
|
var options = serviceProvider.GetRequiredService<AbpHangfireDashboardOptionsProvider>().Get(); |
|
|
|
return context.Services.ExecutePreConfiguredActions(options); |
|
|
|
preActions.Configure(options); |
|
|
|
|
|
|
|
return options; |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -1,5 +1,6 @@ |
|
|
|
using Microsoft.Extensions.Hosting; |
|
|
|
using Microsoft.Extensions.Options; |
|
|
|
using System; |
|
|
|
using System.Threading; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Volo.Abp.Localization; |
|
|
|
@ -23,6 +24,8 @@ namespace LINGYUN.Abp.Localization.Dynamic |
|
|
|
} |
|
|
|
|
|
|
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
foreach (var resource in LocalizationOptions.Resources) |
|
|
|
{ |
|
|
|
@ -39,5 +42,7 @@ namespace LINGYUN.Abp.Localization.Dynamic |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
catch (OperationCanceledException) { } // 忽略此异常
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -11,16 +11,18 @@ namespace LINGYUN.Abp.Notifications.Sms |
|
|
|
{ |
|
|
|
public override void ConfigureServices(ServiceConfigurationContext context) |
|
|
|
{ |
|
|
|
var preSmsActions = context.Services.GetPreConfigureActions<AbpNotificationsSmsOptions>(); |
|
|
|
Configure<AbpNotificationsSmsOptions>(options => |
|
|
|
{ |
|
|
|
context.Services.ExecutePreConfiguredActions(options); |
|
|
|
preSmsActions.Configure(options); |
|
|
|
}); |
|
|
|
|
|
|
|
Configure<AbpNotificationOptions>(options => |
|
|
|
{ |
|
|
|
options.PublishProviders.Add<SmsNotificationPublishProvider>(); |
|
|
|
|
|
|
|
var smsOptions = context.Services.ExecutePreConfiguredActions<AbpNotificationsSmsOptions>(); |
|
|
|
var smsOptions = preSmsActions.Configure(); |
|
|
|
|
|
|
|
options.NotificationDataMappings |
|
|
|
.MappingDefault( |
|
|
|
SmsNotificationPublishProvider.ProviderName, |
|
|
|
|
|
|
|
@ -49,7 +49,7 @@ namespace LINGYUN.Abp.Notifications |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private static void AutoAddDefinitionProviders(IServiceCollection services) |
|
|
|
private void AutoAddDefinitionProviders(IServiceCollection services) |
|
|
|
{ |
|
|
|
var definitionProviders = new List<Type>(); |
|
|
|
|
|
|
|
@ -61,9 +61,10 @@ namespace LINGYUN.Abp.Notifications |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
services.Configure<AbpNotificationOptions>(options => |
|
|
|
var preActions = services.GetPreConfigureActions<AbpNotificationOptions>(); |
|
|
|
Configure<AbpNotificationOptions>(options => |
|
|
|
{ |
|
|
|
services.ExecutePreConfiguredActions(options); |
|
|
|
preActions.Configure(options); |
|
|
|
options.DefinitionProviders.AddIfNotContains(definitionProviders); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
@ -41,9 +41,10 @@ public class YouProjectModule : AbpModule |
|
|
|
public override void ConfigureServices(ServiceConfigurationContext context) |
|
|
|
{ |
|
|
|
var configuration = context.Services.GetConfiguration(); |
|
|
|
var preActions = context.Services.GetPreConfigureActions<AbpBlobStoringOptions>(); |
|
|
|
Configure<AbpBlobStoringOptions>(options => |
|
|
|
{ |
|
|
|
services.ExecutePreConfiguredActions(options); |
|
|
|
preActions.Configure(options); |
|
|
|
// YouContainer use oss management |
|
|
|
options.Containers.Configure<YouContainer>((containerConfiguration) => |
|
|
|
{ |
|
|
|
|
|
|
|
@ -11,16 +11,18 @@ namespace LINGYUN.Abp.Notifications.WeChat.MiniProgram |
|
|
|
{ |
|
|
|
public override void ConfigureServices(ServiceConfigurationContext context) |
|
|
|
{ |
|
|
|
var preActions = context.Services.GetPreConfigureActions<AbpNotificationsWeChatMiniProgramOptions>(); |
|
|
|
|
|
|
|
Configure<AbpNotificationsWeChatMiniProgramOptions>(options => |
|
|
|
{ |
|
|
|
context.Services.ExecutePreConfiguredActions(options); |
|
|
|
preActions.Configure(options); |
|
|
|
}); |
|
|
|
|
|
|
|
Configure<AbpNotificationOptions>(options => |
|
|
|
{ |
|
|
|
options.PublishProviders.Add<WeChatMiniProgramNotificationPublishProvider>(); |
|
|
|
|
|
|
|
var wechatOptions = context.Services.ExecutePreConfiguredActions<AbpNotificationsWeChatMiniProgramOptions>(); |
|
|
|
var wechatOptions = preActions.Configure(); |
|
|
|
options.NotificationDataMappings |
|
|
|
.MappingDefault(WeChatMiniProgramNotificationPublishProvider.ProviderName, |
|
|
|
data => NotificationData.ToStandardData(wechatOptions.DefaultMsgPrefix, data)); |
|
|
|
|
|
|
|
@ -36,9 +36,10 @@ namespace LINGYUN.Abp.WorkflowCore |
|
|
|
|
|
|
|
public override void ConfigureServices(ServiceConfigurationContext context) |
|
|
|
{ |
|
|
|
var preActions = context.Services.GetPreConfigureActions<WorkflowOptions>(); |
|
|
|
context.Services.AddWorkflow(options => |
|
|
|
{ |
|
|
|
context.Services.ExecutePreConfiguredActions(options); |
|
|
|
preActions.Configure(options); |
|
|
|
}); |
|
|
|
context.Services.AddWorkflowDSL(); |
|
|
|
|
|
|
|
|
|
|
|
@ -44,9 +44,10 @@ public partial class WorkflowManagementHttpApiHostModule |
|
|
|
|
|
|
|
private void ConfigureBlobStoring(IServiceCollection services, IConfiguration configuration) |
|
|
|
{ |
|
|
|
var preActions = services.GetPreConfigureActions<AbpBlobStoringOptions>(); |
|
|
|
Configure<AbpBlobStoringOptions>(options => |
|
|
|
{ |
|
|
|
services.ExecutePreConfiguredActions(options); |
|
|
|
preActions.Configure(options); |
|
|
|
options.Containers.Configure<WorkflowContainer>((containerConfiguration) => |
|
|
|
{ |
|
|
|
containerConfiguration.UseOssManagement(config => |
|
|
|
|
|
|
|
@ -58,6 +58,7 @@ |
|
|
|
"LINGYUN.Abp.Features.LimitValidation.Redis.dll", |
|
|
|
"LINGYUN.Abp.WorkflowManagement.Application.Contracts.dll", |
|
|
|
"LINGYUN.Abp.WorkflowManagement.Domain.Shared.dll", |
|
|
|
"LINGYUN.Abp.BackgroundTasks.Abstractions.dll", |
|
|
|
"LINGYUN.Abp.TaskManagement.Application.Contracts.dll", |
|
|
|
"LINGYUN.Abp.TaskManagement.Domain.Shared.dll" |
|
|
|
] |
|
|
|
|