diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Options/PreConfigureActionList.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Options/PreConfigureActionList.cs index 00222d6399..30b96eac2c 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Options/PreConfigureActionList.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Options/PreConfigureActionList.cs @@ -12,5 +12,12 @@ namespace Volo.Abp.Options action(options); } } + + public TOptions Configure() + { + var options = Activator.CreateInstance(); + Configure(options); + return options; + } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/AbpEventBusRebusModule.cs b/framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/AbpEventBusRebusModule.cs index 1ad835c122..806d60bb13 100644 --- a/framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/AbpEventBusRebusModule.cs +++ b/framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/AbpEventBusRebusModule.cs @@ -11,18 +11,17 @@ namespace Volo.Abp.EventBus.Rebus { public override void ConfigureServices(ServiceConfigurationContext context) { - var options = context.Services.ExecutePreConfiguredActions();; - context.Services.AddTransient(typeof(IHandleMessages<>), typeof(RebusDistributedEventHandlerAdapter<>)); + var preActions = context.Services.GetPreConfigureActions(); Configure(rebusOptions => { - context.Services.ExecutePreConfiguredActions(rebusOptions); + preActions.Configure(rebusOptions); }); context.Services.AddRebus(configure => { - options.Configurer?.Invoke(configure); + preActions.Configure().Configurer?.Invoke(configure); return configure; }); } diff --git a/framework/src/Volo.Abp.HangFire/Volo/Abp/Hangfire/AbpHangfireModule.cs b/framework/src/Volo.Abp.HangFire/Volo/Abp/Hangfire/AbpHangfireModule.cs index 1628d2f37f..3cfe62f13d 100644 --- a/framework/src/Volo.Abp.HangFire/Volo/Abp/Hangfire/AbpHangfireModule.cs +++ b/framework/src/Volo.Abp.HangFire/Volo/Abp/Hangfire/AbpHangfireModule.cs @@ -13,9 +13,10 @@ namespace Volo.Abp.Hangfire public override void ConfigureServices(ServiceConfigurationContext context) { + var preActions = context.Services.GetPreConfigureActions(); context.Services.AddHangfire(configuration => { - context.Services.ExecutePreConfiguredActions(configuration); + preActions.Configure(configuration); }); } diff --git a/framework/src/Volo.Abp.Json/Volo/Abp/Json/AbpJsonModule.cs b/framework/src/Volo.Abp.Json/Volo/Abp/Json/AbpJsonModule.cs index a4a08ce274..4e92d7e3b5 100644 --- a/framework/src/Volo.Abp.Json/Volo/Abp/Json/AbpJsonModule.cs +++ b/framework/src/Volo.Abp.Json/Volo/Abp/Json/AbpJsonModule.cs @@ -16,12 +16,11 @@ namespace Volo.Abp.Json context.Services.TryAddEnumerable(ServiceDescriptor .Transient, AbpSystemTextJsonSerializerOptionsSetup>()); + var preActions = context.Services.GetPreConfigureActions(); Configure(options => { options.Providers.Add(); - - var abpJsonOptions = context.Services.ExecutePreConfiguredActions(); - if (abpJsonOptions.UseHybridSerializer) + if (preActions.Configure().UseHybridSerializer) { options.Providers.Add(); } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/AbpAspNetCoreMvcVersioningTestModule.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/AbpAspNetCoreMvcVersioningTestModule.cs index 4e28d77a0a..8e7ed9bba2 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/AbpAspNetCoreMvcVersioningTestModule.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/AbpAspNetCoreMvcVersioningTestModule.cs @@ -38,9 +38,10 @@ namespace Volo.Abp.AspNetCore.Mvc.Versioning public override void ConfigureServices(ServiceConfigurationContext context) { + var preActions = context.Services.GetPreConfigureActions(); Configure(options => { - context.Services.ExecutePreConfiguredActions(options); + preActions.Configure(options); }); context.Services.AddAbpApiVersioning(options => @@ -51,8 +52,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Versioning //options.ApiVersionReader = new HeaderApiVersionReader("api-version"); //Supports header too //options.ApiVersionReader = new MediaTypeApiVersionReader(); //Supports accept header too - var mvcOptions = context.Services.ExecutePreConfiguredActions(); - options.ConfigureAbp(mvcOptions); + options.ConfigureAbp(preActions.Configure()); }); context.Services.AddHttpClientProxies(typeof(AbpAspNetCoreMvcVersioningTestModule).Assembly);