
复制/// <summary> /// 为业务类添加AOP拦截器。聊下 /// </summary> public class InterceptorAttribute:PlutoStudio.Aop.InterceptorAttribute { /// <summary> /// 拦截方法的基本
执行,
香港云服务器如果当前方法有拦截处理器,用法
则执行处理器。
网站模板聊下 /// </summary> /// <param name="invocation">被拦截的基本调用目标对象</param> public override void Intercept(IInvocation invocation) { var method = invocation.Method; var processors = method.GetCustomAttributes(typeof(IInterceptorProcessor),true).Cast<IInterceptorProcessor>().ToList(); processors.ForEach(p => PlutoStudio.MefContainer.Container.ComposeParts(p)); if (processors.Count>0) { processors.ForEach(p => p.PreProcess(invocation)); try { invocation.Proceed(); processors.ForEach(p => p.PostProcess(invocation, null)); } catch (Exception ex) { processors.ForEach(p => p.PostProcess(invocation, ex)); throw; } } else { invocation.Proceed(); } } } 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.30.31.32.33.34.
b2b供应网(责任编辑:应用开发)