private IAspectBuilder Create(Tuple <MethodInfo, MethodInfo> tuple) { var aspectBuilder = new AspectBuilder(context => context.Complete(), null); aspectBuilder.AddAspectDelegate((conext, next) => { conext.AdditionalData.Add(AspectClientsExtensions.Context_IsRpcClient, true); return(next(conext)); }); foreach (var interceptor in interceptorCollector.Collect(tuple.Item1, tuple.Item2)) { aspectBuilder.AddAspectDelegate(interceptor.Invoke); } var func = clientFactory.GetClientInvoker(tuple.Item1); aspectBuilder.AddAspectDelegate(func); return(aspectBuilder); }
public IAspectBuilder Create(AspectContext context) { var aspectBuilder = new AspectBuilder(ctx => ctx.Complete(), null); foreach (var interceptor in _interceptorCollector.Collect(context.ServiceMethod, context.ImplementationMethod)) { if (interceptor is IScopeInterceptor scopedInterceptor) { if (!_aspectContextScheduler.TryRelate(context as ScopeAspectContext, scopedInterceptor)) { continue; } } aspectBuilder.AddAspectDelegate(interceptor.Invoke); } return(aspectBuilder); }