コード例 #1
0
        protected object Invoke(object[] arguments)
        {
            var call   = new Call(MethodToInvoke, arguments, this, _parameterInfos);
            var result = _callRouter.Route(call);

            return(EnsureResultCompatibleWithReturnType(result));
        }
コード例 #2
0
        public void Intercept(IInvocation invocation)
        {
            if (!_isIntercepting)
            {
                return;
            }
            var mappedInvocation = _invocationMapper.Map(invocation);

            invocation.ReturnValue = _callRouter.Route(mappedInvocation);
        }
        public object Route(ICall call)
        {
            Trace($"Route(call: {call.DiagName(_ctx)})");
            Log($"[Received call] " +
                $"Substitute: {call.Target().SubstituteId(_ctx)} " +
                $"Call: {call.FormatArgs(_ctx)} " +
                $"Signature: {call.GetMethodInfo().DiagName()} " +
                $"Argument specifications: {call.GetArgumentSpecifications().Print(s => s.DiagName())}");

            using (new LoggingScope())
            {
                return(_impl.Route(call));
            }
        }
コード例 #4
0
        public void Intercept(IInvocation invocation)
        {
            var mappedInvocation = _invocationMapper.Map(invocation);

            if (_fullDispatchMode)
            {
                invocation.ReturnValue = _callRouter.Route(mappedInvocation);
                return;
            }

            // Fallback to the base value until the full dispatch mode is activated.
            // Useful to ensure that object is initialized properly.
            if (_callRouter.CallBaseByDefault)
            {
                invocation.ReturnValue = mappedInvocation.TryCallBase().ValueOrDefault();
            }
        }