Exemplo n.º 1
0
            public async Task <TResult> HandleAsync(XtResult <T> incomingRequest)
            {
                T request = incomingRequest.IsSuccess ? incomingRequest.GetResult() : new T();

                if (asyncCallback is null)
                {
                    return(syncCallback(request));
                }
                else
                {
                    return(await asyncCallback(request));
                }
            }
Exemplo n.º 2
0
        internal static async Task RequestAndWriteResultAsync(RqRep rqRep)
        {
            XtResult <Response> result = await rqRep.RequestAsync <Request, Response>(new Request());

            System.Console.WriteLine(result);

            if (result.IsSuccess)
            {
                System.Console.WriteLine("SUCCESS!! " + result.GetResult().InsideResponse);
            }
            else
            {
                System.Console.WriteLine("FAILURE!! " + result.Exception);
            }
        }