public RouteAction Handle(ICall call)
        {
            if (!_required) return RouteAction.Continue();
            if (_callBaseExclusions.IsExcluded(call)) return RouteAction.Continue();

            return call
                    .TryCallBase()
                    .Fold(RouteAction.Continue, RouteAction.Return);
        }
Ejemplo n.º 2
0
        public RouteAction Handle(ICall call)
        {
            if (_config.ShouldCallBase(call))
            {
                return(call
                       .TryCallBase()
                       .Fold(RouteAction.Continue, RouteAction.Return));
            }

            return(RouteAction.Continue());
        }
Ejemplo n.º 3
0
        public RouteAction Handle(ICall call)
        {
            if (!_required)
            {
                return(RouteAction.Continue());
            }
            if (_callBaseExclusions.IsExcluded(call))
            {
                return(RouteAction.Continue());
            }

            return(call
                   .TryCallBase()
                   .Fold(RouteAction.Continue, RouteAction.Return));
        }
Ejemplo n.º 4
0
        public RouteAction Handle(ICall call)
        {
            if (call == null)
            {
                throw new ArgumentNullException(nameof(call));
            }

            if (_config.ShouldCallBase(call))
            {
                return(call
                       .TryCallBase()
                       .Fold(RouteAction.Continue, RouteAction.Return));
            }

            return(RouteAction.Continue());
        }
        public void Intercept(IInvocation invocation)
        {
            ICall 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();
            }
        }