@@ -10,32 +10,6 @@ namespace Microsoft.Extensions.DependencyInjection
1010 /// </summary>
1111 public static class HttpApiConfigureExtensions
1212 {
13- /// <summary>
14- /// 为接口配置HttpApiOptions
15- /// </summary>
16- /// <typeparam name="THttpApi"></typeparam>
17- /// <param name="services"></param>
18- /// <returns></returns>
19- public static OptionsBuilder < HttpApiOptions > AddHttpApiOptions < THttpApi > ( this IServiceCollection services )
20- {
21- return services . AddHttpApiOptions ( typeof ( THttpApi ) ) ;
22- }
23-
24- /// <summary>
25- /// 为接口配置HttpApiOptions
26- /// </summary>
27- /// <param name="services"></param>
28- /// <param name="httpApiType">接口类型</param>
29- /// <returns></returns>
30- public static OptionsBuilder < HttpApiOptions > AddHttpApiOptions ( this IServiceCollection services , Type httpApiType )
31- {
32- var name = HttpApi . GetName ( httpApiType ) ;
33- return services . AddOptions < HttpApiOptions > ( name ) ;
34- }
35-
36-
37-
38-
3913 /// <summary>
4014 /// 为接口配置HttpApiOptions
4115 /// </summary>
@@ -109,5 +83,28 @@ public static IServiceCollection ConfigureHttpApi(this IServiceCollection servic
10983 {
11084 return services . AddHttpApiOptions ( httpApiType ) . Bind ( configureOptions ) . Services ;
11185 }
86+
87+ /// <summary>
88+ /// 为接口配置HttpApiOptions
89+ /// </summary>
90+ /// <typeparam name="THttpApi"></typeparam>
91+ /// <param name="services"></param>
92+ /// <returns></returns>
93+ private static OptionsBuilder < HttpApiOptions > AddHttpApiOptions < THttpApi > ( this IServiceCollection services )
94+ {
95+ return services . AddHttpApiOptions ( typeof ( THttpApi ) ) ;
96+ }
97+
98+ /// <summary>
99+ /// 为接口配置HttpApiOptions
100+ /// </summary>
101+ /// <param name="services"></param>
102+ /// <param name="httpApiType">接口类型</param>
103+ /// <returns></returns>
104+ private static OptionsBuilder < HttpApiOptions > AddHttpApiOptions ( this IServiceCollection services , Type httpApiType )
105+ {
106+ var name = HttpApi . GetName ( httpApiType ) ;
107+ return services . AddOptions < HttpApiOptions > ( name ) ;
108+ }
112109 }
113110}
0 commit comments