@@ -10,9 +10,8 @@ namespace Microsoft.Extensions.DependencyInjection;
1010using Microsoft . AspNetCore . Routing ;
1111using Microsoft . Extensions . DependencyInjection . Extensions ;
1212using Microsoft . Extensions . Options ;
13- using System ;
1413using System . Diagnostics . CodeAnalysis ;
15- using static Microsoft . Extensions . DependencyInjection . ServiceDescriptor ;
14+ using static ServiceDescriptor ;
1615using static System . Diagnostics . CodeAnalysis . DynamicallyAccessedMemberTypes ;
1716
1817/// <summary>
@@ -141,9 +140,9 @@ private static void AddApiVersioningServices( IServiceCollection services )
141140 ArgumentNullException . ThrowIfNull ( services ) ;
142141
143142 services . TryAddSingleton < IApiVersionParser , ApiVersionParser > ( ) ;
144- services . AddSingleton ( sp => sp . GetRequiredService < IOptions < ApiVersioningOptions > > ( ) . Value . ApiVersionReader ) ;
145- services . AddSingleton ( sp => ( IApiVersionParameterSource ) sp . GetRequiredService < IOptions < ApiVersioningOptions > > ( ) . Value . ApiVersionReader ) ;
146- services . AddSingleton ( sp => sp . GetRequiredService < IOptions < ApiVersioningOptions > > ( ) . Value . ApiVersionSelector ) ;
143+ services . AddSingleton ( static sp => sp . GetRequiredService < IOptions < ApiVersioningOptions > > ( ) . Value . ApiVersionReader ) ;
144+ services . AddSingleton ( static sp => ( IApiVersionParameterSource ) sp . GetRequiredService < IOptions < ApiVersioningOptions > > ( ) . Value . ApiVersionReader ) ;
145+ services . AddSingleton ( static sp => sp . GetRequiredService < IOptions < ApiVersioningOptions > > ( ) . Value . ApiVersionSelector ) ;
147146 services . TryAddSingleton < IReportApiVersions , DefaultApiVersionReporter > ( ) ;
148147 services . TryAddSingleton < ISunsetPolicyManager , SunsetPolicyManager > ( ) ;
149148 services . TryAddEnumerable ( Transient < IValidateOptions < ApiVersioningOptions > , ValidateApiVersioningOptions > ( ) ) ;
0 commit comments