Beispiel #1
0
        protected object Invoke(object[] arguments)
        {
            var queuedArgSpecs = _argSpecificationDequeue.DequeueAllArgumentSpecificationsForMethod(MethodToInvoke);
            var call           = _callFactory.Create(MethodToInvoke, arguments, this, queuedArgSpecs, _parameterInfos);
            var result         = CallRouter.Route(call);

            return(EnsureResultCompatibleWithReturnType(result));
        }
Beispiel #2
0
        public virtual ICall Map(IInvocation castleInvocation)
        {
            Func <object>?baseMethod = null;

            if (castleInvocation.InvocationTarget != null &&
                castleInvocation.MethodInvocationTarget.IsVirtual &&
                !castleInvocation.MethodInvocationTarget.IsAbstract &&
                !castleInvocation.MethodInvocationTarget.IsFinal)
            {
                baseMethod = CreateBaseResultInvocation(castleInvocation);
            }

            var queuedArgSpecifications = _argSpecificationDequeue.DequeueAllArgumentSpecificationsForMethod(castleInvocation.Arguments.Length);

            return(_callFactory.Create(castleInvocation.Method, castleInvocation.Arguments, castleInvocation.Proxy, queuedArgSpecifications, baseMethod));
        }
Beispiel #3
0
        public virtual ICall Map(IInvocation castleInvocation)
        {
            Func <object> baseMethod = null;

            if (castleInvocation.InvocationTarget != null &&
                castleInvocation.MethodInvocationTarget.IsVirtual &&
                !castleInvocation.MethodInvocationTarget.IsAbstract &&
                !castleInvocation.MethodInvocationTarget.IsFinal)
            {
                Func <object> baseResult = () => { castleInvocation.Proceed(); return(castleInvocation.ReturnValue); };
                var           result     = new Lazy <object>(baseResult);
                baseMethod = () => result.Value;
            }

            var queuedArgSpecifications = _argSpecificationDequeue.DequeueAllArgumentSpecificationsForMethod(castleInvocation.Method);

            return(_callFactory.Create(castleInvocation.Method, castleInvocation.Arguments, castleInvocation.Proxy, queuedArgSpecifications, baseMethod));
        }