Merge pull request #11130 from abpframework/maliming/configure

Get the configured actions in advance.
pull/11139/head
Halil İbrahim Kalkan 4 years ago committed by GitHub
commit a506db5fc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -12,5 +12,12 @@ namespace Volo.Abp.Options
action(options);
}
}
public TOptions Configure()
{
var options = Activator.CreateInstance<TOptions>();
Configure(options);
return options;
}
}
}
}

@ -11,18 +11,17 @@ namespace Volo.Abp.EventBus.Rebus
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var options = context.Services.ExecutePreConfiguredActions<AbpRebusEventBusOptions>();;
context.Services.AddTransient(typeof(IHandleMessages<>), typeof(RebusDistributedEventHandlerAdapter<>));
var preActions = context.Services.GetPreConfigureActions<AbpRebusEventBusOptions>();
Configure<AbpRebusEventBusOptions>(rebusOptions =>
{
context.Services.ExecutePreConfiguredActions(rebusOptions);
preActions.Configure(rebusOptions);
});
context.Services.AddRebus(configure =>
{
options.Configurer?.Invoke(configure);
preActions.Configure().Configurer?.Invoke(configure);
return configure;
});
}

@ -13,9 +13,10 @@ namespace Volo.Abp.Hangfire
public override void ConfigureServices(ServiceConfigurationContext context)
{
var preActions = context.Services.GetPreConfigureActions<IGlobalConfiguration>();
context.Services.AddHangfire(configuration =>
{
context.Services.ExecutePreConfiguredActions(configuration);
preActions.Configure(configuration);
});
}

@ -16,12 +16,11 @@ namespace Volo.Abp.Json
context.Services.TryAddEnumerable(ServiceDescriptor
.Transient<IConfigureOptions<AbpSystemTextJsonSerializerOptions>, AbpSystemTextJsonSerializerOptionsSetup>());
var preActions = context.Services.GetPreConfigureActions<AbpJsonOptions>();
Configure<AbpJsonOptions>(options =>
{
options.Providers.Add<AbpNewtonsoftJsonSerializerProvider>();
var abpJsonOptions = context.Services.ExecutePreConfiguredActions<AbpJsonOptions>();
if (abpJsonOptions.UseHybridSerializer)
if (preActions.Configure().UseHybridSerializer)
{
options.Providers.Add<AbpSystemTextJsonSerializerProvider>();
}

@ -38,9 +38,10 @@ namespace Volo.Abp.AspNetCore.Mvc.Versioning
public override void ConfigureServices(ServiceConfigurationContext context)
{
var preActions = context.Services.GetPreConfigureActions<AbpAspNetCoreMvcOptions>();
Configure<AbpAspNetCoreMvcOptions>(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<AbpAspNetCoreMvcOptions>();
options.ConfigureAbp(mvcOptions);
options.ConfigureAbp(preActions.Configure());
});
context.Services.AddHttpClientProxies(typeof(AbpAspNetCoreMvcVersioningTestModule).Assembly);

Loading…
Cancel
Save