66namespace WebApiClientCore
77{
88 /// <summary>
9- /// 表示THttpApi的代理类的实例创建者
9+ /// 表示THttpApi的代理类的创建工厂
1010 /// </summary>
1111 /// <typeparam name="THttpApi">接口类型</typeparam>
12- class HttpApiProxyBuilder < THttpApi >
12+ class HttpApiProxyFactory < THttpApi >
1313 {
1414 /// <summary>
1515 /// 接口包含的所有action执行器
@@ -22,11 +22,11 @@ class HttpApiProxyBuilder<THttpApi>
2222 private readonly Func < IActionInterceptor , IActionInvoker [ ] , THttpApi > proxyTypeCtor ;
2323
2424 /// <summary>
25- /// IHttpApi的代理类的实例创建者
25+ /// 表示THttpApi的代理类的创建工厂
2626 /// </summary>
2727 /// <exception cref="NotSupportedException"></exception>
2828 /// <exception cref="ProxyTypeCreateException"></exception>
29- private HttpApiProxyBuilder ( )
29+ private HttpApiProxyFactory ( )
3030 {
3131 var interfaceType = typeof ( THttpApi ) ;
3232
@@ -48,38 +48,38 @@ static IActionInvoker CreateActionInvoker(ApiActionDescriptor apiAction)
4848 }
4949
5050 /// <summary>
51- /// 创建IHttpApi的代理类的实例
51+ /// 创建代理类的实例
5252 /// </summary>
5353 /// <param name="actionInterceptor">拦截器</param>
5454 /// <returns></returns>
55- private THttpApi BuildCore ( IActionInterceptor actionInterceptor )
55+ private THttpApi CreateProxy ( IActionInterceptor actionInterceptor )
5656 {
5757 return this . proxyTypeCtor . Invoke ( actionInterceptor , this . actionInvokers ) ;
5858 }
5959
6060
6161 /// <summary>
62- /// 代理生成器的实例
62+ /// 代理创建工厂的实例
6363 /// </summary>
64- private static HttpApiProxyBuilder < THttpApi > ? instance ;
64+ private static HttpApiProxyFactory < THttpApi > ? instance ;
6565
6666 /// <summary>
67- /// 创建IHttpApi的代理类的实例
67+ /// 创建代理类的实例
6868 /// </summary>
6969 /// <param name="actionInterceptor">拦截器</param>
7070 /// <exception cref="NotSupportedException"></exception>
7171 /// <exception cref="ProxyTypeCreateException"></exception>
7272 /// <returns></returns>
73- public static THttpApi Build ( IActionInterceptor actionInterceptor )
73+ public static THttpApi Create ( IActionInterceptor actionInterceptor )
7474 {
75- var builder = Volatile . Read ( ref instance ) ;
76- if ( builder == null )
75+ var fatory = Volatile . Read ( ref instance ) ;
76+ if ( fatory == null )
7777 {
78- Interlocked . CompareExchange ( ref instance , new HttpApiProxyBuilder < THttpApi > ( ) , null ) ;
79- builder = instance ;
78+ Interlocked . CompareExchange ( ref instance , new HttpApiProxyFactory < THttpApi > ( ) , null ) ;
79+ fatory = instance ;
8080 }
8181
82- return builder . BuildCore ( actionInterceptor ) ;
82+ return fatory . CreateProxy ( actionInterceptor ) ;
8383 }
8484 }
85- }
85+ }
0 commit comments