public InterceptorMethodHandler(WeldComponentManager manager, MethodInfo method, Interceptor[] interceptors, ICreationalContext creationalContext) { _interceptorReferences = new LinkedList <IAroundInvokeInterceptor>( interceptors.Select(x => manager.GetReference(x, creationalContext)) .Cast <IAroundInvokeInterceptor>()); _bindingsLazy = new Lazy <IEnumerable <IInterceptorBinding> >(() => method.GetAnnotations().OfType <IInterceptorBinding>().ToArray()); var returnType = method.ReturnType; if (returnType == typeof(Task)) { _isAsync = true; _taskCaster = TaskCasters.ForVoid(); } else if (returnType.IsGenericType) { var genericType = returnType.GetGenericTypeDefinition(); if (genericType == typeof(Task <>)) { _isAsync = true; _taskCaster = TaskCasters.ForType(returnType.GetGenericArguments()[0]); } } }
public InvocationContext(Lazy <IEnumerable <IInterceptorBinding> > bindingsLazy, IInvocation castleInvocation, LinkedListNode <IAroundInvokeInterceptor> nextInterceptor, bool isAsync, ITaskCaster taskCaster) { _bindingsLazy = bindingsLazy; _castleInvocation = castleInvocation; _nextInterceptor = nextInterceptor; _isAsync = isAsync; _taskCaster = taskCaster; }