@@ -18,7 +18,11 @@ public static class HttpApiExtensions
1818 /// <typeparam name="THttpApi"></typeparam>
1919 /// <param name="services"></param>
2020 /// <returns></returns>
21- public static IHttpClientBuilder AddHttpApi < THttpApi > ( this IServiceCollection services ) where THttpApi : class
21+ public static IHttpClientBuilder AddHttpApi <
22+ #if NET5_0_OR_GREATER
23+ [ System . Diagnostics . CodeAnalysis . DynamicallyAccessedMembers ( System . Diagnostics . CodeAnalysis . DynamicallyAccessedMemberTypes . PublicConstructors ) ]
24+ #endif
25+ THttpApi > ( this IServiceCollection services ) where THttpApi : class
2226 {
2327 var name = HttpApi . GetName ( typeof ( THttpApi ) ) ;
2428
@@ -41,7 +45,11 @@ public static IHttpClientBuilder AddHttpApi<THttpApi>(this IServiceCollection se
4145 /// <param name="services"></param>
4246 /// <param name="configureOptions">配置选项</param>
4347 /// <returns></returns>
44- public static IHttpClientBuilder AddHttpApi < THttpApi > ( this IServiceCollection services , Action < HttpApiOptions > configureOptions ) where THttpApi : class
48+ public static IHttpClientBuilder AddHttpApi <
49+ #if NET5_0_OR_GREATER
50+ [ System . Diagnostics . CodeAnalysis . DynamicallyAccessedMembers ( System . Diagnostics . CodeAnalysis . DynamicallyAccessedMemberTypes . PublicConstructors ) ]
51+ #endif
52+ THttpApi > ( this IServiceCollection services , Action < HttpApiOptions > configureOptions ) where THttpApi : class
4553 {
4654 return services
4755 . AddHttpApi < THttpApi > ( )
@@ -55,7 +63,11 @@ public static IHttpClientBuilder AddHttpApi<THttpApi>(this IServiceCollection se
5563 /// <param name="services"></param>
5664 /// <param name="configureOptions">配置选项</param>
5765 /// <returns></returns>
58- public static IHttpClientBuilder AddHttpApi < THttpApi > ( this IServiceCollection services , Action < HttpApiOptions , IServiceProvider > configureOptions ) where THttpApi : class
66+ public static IHttpClientBuilder AddHttpApi <
67+ #if NET5_0_OR_GREATER
68+ [ System . Diagnostics . CodeAnalysis . DynamicallyAccessedMembers ( System . Diagnostics . CodeAnalysis . DynamicallyAccessedMemberTypes . PublicConstructors ) ]
69+ #endif
70+ THttpApi > ( this IServiceCollection services , Action < HttpApiOptions , IServiceProvider > configureOptions ) where THttpApi : class
5971 {
6072 return services
6173 . AddHttpApi < THttpApi > ( )
@@ -121,7 +133,11 @@ public static IHttpClientBuilder AddHttpApi(this IServiceCollection services, Ty
121133 /// 表示THttpApi提供者
122134 /// </summary>
123135 /// <typeparam name="THttpApi"></typeparam>
124- private class HttpApiProvider < THttpApi >
136+ private class HttpApiProvider <
137+ #if NET5_0_OR_GREATER
138+ [ System . Diagnostics . CodeAnalysis . DynamicallyAccessedMembers ( System . Diagnostics . CodeAnalysis . DynamicallyAccessedMemberTypes . PublicConstructors ) ]
139+ #endif
140+ THttpApi >
125141 {
126142 private readonly IHttpClientFactory httpClientFactory ;
127143 private readonly IOptionsMonitor < HttpApiOptions > httpApiOptionsMonitor ;
@@ -188,7 +204,11 @@ public static HttpApiAdder Create(Type httpApiType)
188204 /// 表示HttpApi服务添加者
189205 /// </summary>
190206 /// <typeparam name="THttpApi"></typeparam>
191- private class HttpApiAdderOf < THttpApi > : HttpApiAdder where THttpApi : class
207+ private class HttpApiAdderOf <
208+ #if NET5_0_OR_GREATER
209+ [ System . Diagnostics . CodeAnalysis . DynamicallyAccessedMembers ( System . Diagnostics . CodeAnalysis . DynamicallyAccessedMemberTypes . PublicConstructors ) ]
210+ #endif
211+ THttpApi > : HttpApiAdder where THttpApi : class
192212 {
193213 /// <summary>
194214 /// 添加HttpApi代理类到服务
0 commit comments