public async Task <Result <TR> > Handle <TR>(Func <Task <Result <TR> > > func)
        {
            Console.WriteLine("----------------Method star-----------------------");
            Result <TR> result = next != null ? await next.Handle(func).ConfigureAwait(false) : await func().ConfigureAwait(false);

            Console.WriteLine("----------------Method end------------------------");
            return(result);
        }
Example #2
0
        public async Task <Result <TR> > Handle <TR>(Func <Task <Result <TR> > > func)
        {
            Console.WriteLine("Logger started");
            Result <TR> result;

            if (next != null)
            {
                result = await next.Handle(func).ConfigureAwait(false);
            }
            else
            {
                result = await func().ConfigureAwait(false);
            }
            Console.WriteLine("Logger => result has status: " + result.IsSuccess);
            return(result);
        }
Example #3
0
        public async Task <Result <TR> > Handle <TR>(Func <Task <Result <TR> > > func)
        {
            Result <TR> result;

            try
            {
                if (next != null)
                {
                    result = await next.Handle(func).ConfigureAwait(false);
                }
                else
                {
                    result = await func().ConfigureAwait(false);
                }
                return(result);
            }
            catch (Exception ex)
            {
                return(Result.Fail <TR>(ex.Message));
            }
        }