Example #1
0
        public Task <object> Proceed()
        {
            var interceptor = _nextInterceptor;

            if (_nextInterceptor != null)
            {
                _nextInterceptor = interceptor.Next;
                return(interceptor.Value.AroundInvoke(this));
            }

            _castleInvocation.Proceed();
            var returnValue = _castleInvocation.ReturnValue;

            if (_isAsync)
            {
                if (_taskCaster == null || returnValue == null)
                {
                    return((Task <object>)returnValue);
                }
                return(_taskCaster.ToObject((Task)returnValue));
            }

            return(Task.FromResult(returnValue));
        }