@@ -14,15 +14,15 @@ namespace WebApiClientCore.Implementations
1414 public class HttpApiEmitActivator < THttpApi > : HttpApiActivator < THttpApi >
1515 {
1616 /// <summary>
17- /// IApiActionInterceptor的Intercept方法
17+ /// IHttpApiInterceptor的Intercept方法
1818 /// </summary>
19- private static readonly MethodInfo interceptMethod = typeof ( IApiActionInterceptor ) . GetMethod ( nameof ( IApiActionInterceptor . Intercept ) ) ?? throw new MissingMethodException ( nameof ( IApiActionInterceptor . Intercept ) ) ;
19+ private static readonly MethodInfo interceptMethod = typeof ( IHttpApiInterceptor ) . GetMethod ( nameof ( IHttpApiInterceptor . Intercept ) ) ?? throw new MissingMethodException ( nameof ( IHttpApiInterceptor . Intercept ) ) ;
2020
2121 /// <summary>
2222 /// 代理类型的构造器的参数类型
23- /// (IApiActionInterceptor interceptor,ApiActionInvoker[] actionInvokers)
23+ /// (IHttpApiInterceptor interceptor,ApiActionInvoker[] actionInvokers)
2424 /// </summary>
25- private static readonly Type [ ] proxyTypeCtorArgTypes = new Type [ ] { typeof ( IApiActionInterceptor ) , typeof ( ApiActionInvoker [ ] ) } ;
25+ private static readonly Type [ ] proxyTypeCtorArgTypes = new Type [ ] { typeof ( IHttpApiInterceptor ) , typeof ( ApiActionInvoker [ ] ) } ;
2626
2727
2828 /// <summary>
@@ -43,10 +43,10 @@ public HttpApiEmitActivator(IApiActionDescriptorProvider apiActionDescriptorProv
4343 /// <exception cref="NotSupportedException"></exception>
4444 /// <exception cref="ProxyTypeCreateException"></exception>
4545 /// <returns></returns>
46- protected override Func < IApiActionInterceptor , ApiActionInvoker [ ] , THttpApi > CreateFactory ( )
46+ protected override Func < IHttpApiInterceptor , ApiActionInvoker [ ] , THttpApi > CreateFactory ( )
4747 {
4848 var proxyType = BuildProxyType ( typeof ( THttpApi ) , this . ApiMethods ) ;
49- return LambdaUtil . CreateCtorFunc < IApiActionInterceptor , ApiActionInvoker [ ] , THttpApi > ( proxyType ) ;
49+ return LambdaUtil . CreateCtorFunc < IHttpApiInterceptor , ApiActionInvoker [ ] , THttpApi > ( proxyType ) ;
5050 }
5151
5252 /// <summary>
@@ -77,11 +77,11 @@ private static Type BuildProxyType(Type interfaceType, MethodInfo[] apiMethods)
7777 var builder = module . DefineType ( typeName , System . Reflection . TypeAttributes . Class ) ;
7878 builder . AddInterfaceImplementation ( interfaceType ) ;
7979
80- var fieldActionInterceptor = BuildField ( builder , "<>actionInterceptor " , typeof ( IApiActionInterceptor ) ) ;
80+ var fieldApiInterceptor = BuildField ( builder , "<>apiInterceptor " , typeof ( IHttpApiInterceptor ) ) ;
8181 var fieldActionInvokers = BuildField ( builder , "<>actionInvokers" , typeof ( ApiActionInvoker [ ] ) ) ;
8282
83- BuildCtor ( builder , fieldActionInterceptor , fieldActionInvokers ) ;
84- BuildMethods ( builder , apiMethods , fieldActionInterceptor , fieldActionInvokers ) ;
83+ BuildCtor ( builder , fieldApiInterceptor , fieldActionInvokers ) ;
84+ BuildMethods ( builder , apiMethods , fieldApiInterceptor , fieldActionInvokers ) ;
8585
8686 var proxyType = builder . CreateType ( ) ;
8787 return proxyType ?? throw new ProxyTypeCreateException ( interfaceType ) ;
@@ -104,20 +104,20 @@ private static FieldBuilder BuildField(TypeBuilder builder, string fieldName, Ty
104104 /// 生成代理类型的构造器
105105 /// </summary>
106106 /// <param name="builder">类型生成器</param>
107- /// <param name="fieldActionInterceptor ">拦截器字段</param>
107+ /// <param name="fieldApiInterceptor ">拦截器字段</param>
108108 /// <param name="fieldActionInvokers">action执行器字段</param>
109109 /// <returns></returns>
110- private static void BuildCtor ( TypeBuilder builder , FieldBuilder fieldActionInterceptor , FieldBuilder fieldActionInvokers )
110+ private static void BuildCtor ( TypeBuilder builder , FieldBuilder fieldApiInterceptor , FieldBuilder fieldActionInvokers )
111111 {
112- // .ctor(IApiActionInterceptor actionInterceptor , ApiActionInvoker[] actionInvokers)
112+ // .ctor(IHttpApiInterceptor apiInterceptor , ApiActionInvoker[] actionInvokers)
113113 var ctor = builder . DefineConstructor ( MethodAttributes . Public , CallingConventions . Standard , proxyTypeCtorArgTypes ) ;
114114
115115 var il = ctor . GetILGenerator ( ) ;
116116
117- // this.actionInterceptor = 第一个参数
117+ // this.apiInterceptor = 第一个参数
118118 il . Emit ( OpCodes . Ldarg_0 ) ;
119119 il . Emit ( OpCodes . Ldarg_1 ) ;
120- il . Emit ( OpCodes . Stfld , fieldActionInterceptor ) ;
120+ il . Emit ( OpCodes . Stfld , fieldApiInterceptor ) ;
121121
122122 // this.actionInvokers = 第二个参数
123123 il . Emit ( OpCodes . Ldarg_0 ) ;
@@ -132,9 +132,9 @@ private static void BuildCtor(TypeBuilder builder, FieldBuilder fieldActionInter
132132 /// </summary>
133133 /// <param name="builder">类型生成器</param>
134134 /// <param name="actionMethods">接口的方法</param>
135- /// <param name="fieldActionInterceptor ">拦截器字段</param>
135+ /// <param name="fieldApiInterceptor ">拦截器字段</param>
136136 /// <param name="fieldActionInvokers">action执行器字段</param>
137- private static void BuildMethods ( TypeBuilder builder , MethodInfo [ ] actionMethods , FieldBuilder fieldActionInterceptor , FieldBuilder fieldActionInvokers )
137+ private static void BuildMethods ( TypeBuilder builder , MethodInfo [ ] actionMethods , FieldBuilder fieldApiInterceptor , FieldBuilder fieldActionInvokers )
138138 {
139139 const MethodAttributes implementAttribute = MethodAttributes . Public | MethodAttributes . Virtual | MethodAttributes . Final | MethodAttributes . NewSlot | MethodAttributes . HideBySig ;
140140
@@ -148,9 +148,9 @@ private static void BuildMethods(TypeBuilder builder, MethodInfo[] actionMethods
148148 . DefineMethod ( actionMethod . Name , implementAttribute , CallingConventions . Standard , actionMethod . ReturnType , parameterTypes )
149149 . GetILGenerator ( ) ;
150150
151- // this.actionInterceptor
151+ // this.apiInterceptor
152152 iL . Emit ( OpCodes . Ldarg_0 ) ;
153- iL . Emit ( OpCodes . Ldfld , fieldActionInterceptor ) ;
153+ iL . Emit ( OpCodes . Ldfld , fieldApiInterceptor ) ;
154154
155155 // this.actionInvokers[i]
156156 iL . Emit ( OpCodes . Ldarg_0 ) ;
0 commit comments