diff --git a/framework/src/Volo.Abp.AspNetCore/Microsoft/Extensions/DependencyInjection/AbpAspNetCoreServiceCollectionExtensions.cs b/framework/src/Volo.Abp.AspNetCore/Microsoft/Extensions/DependencyInjection/AbpAspNetCoreServiceCollectionExtensions.cs index cf11ab32c3..9d754b8da4 100644 --- a/framework/src/Volo.Abp.AspNetCore/Microsoft/Extensions/DependencyInjection/AbpAspNetCoreServiceCollectionExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore/Microsoft/Extensions/DependencyInjection/AbpAspNetCoreServiceCollectionExtensions.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNetCore.Hosting; +using System; +using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; namespace Microsoft.Extensions.DependencyInjection @@ -10,11 +11,13 @@ namespace Microsoft.Extensions.DependencyInjection return services.GetSingletonInstance(); } + [Obsolete] public static IConfigurationRoot BuildConfiguration(this IServiceCollection services, ConfigurationBuilderOptions options = null) { return services.GetHostingEnvironment().BuildConfiguration(options); } + [Obsolete] public static IConfigurationRoot AddConfiguration(this IServiceCollection services, ConfigurationBuilderOptions options = null) { var configuration = services.BuildConfiguration(options); diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/ApplicationInitializationContextExtensions.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/ApplicationInitializationContextExtensions.cs index 616afc8427..a2b66c76c2 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/ApplicationInitializationContextExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/ApplicationInitializationContextExtensions.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Volo.Abp.DependencyInjection; @@ -18,6 +19,11 @@ namespace Volo.Abp return context.ServiceProvider.GetRequiredService(); } + public static IConfiguration GetConfiguration(this ApplicationInitializationContext context) + { + return context.ServiceProvider.GetRequiredService(); + } + public static ILoggerFactory GetLoggerFactory(this ApplicationInitializationContext context) { return context.ServiceProvider.GetRequiredService(); diff --git a/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj b/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj index b405e10f59..7d6562e478 100644 --- a/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj +++ b/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj @@ -20,6 +20,7 @@ + diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/Startup.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/Startup.cs index 9428c74114..5bacb0f77e 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/Startup.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/Startup.cs @@ -1,6 +1,5 @@ using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; namespace MyCompanyName.MyProjectName.Web { @@ -11,7 +10,7 @@ namespace MyCompanyName.MyProjectName.Web services.AddApplication(); } - public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) + public void Configure(IApplicationBuilder app) { app.InitializeApplication(); }