Ejemplo n.º 1
0
        public static T SetResponse <T>(this XenMessageContext ctx, Action <T> action = null) where T : Response, new()
        {
            var response = XenMessage.Create <T>();

            ctx.Response = response;

            action?.Invoke(response);

            return((T)ctx.Response);
        }
Ejemplo n.º 2
0
        public static T SetRequest <T>(this XenMessageContext ctx, Action <T> action = null) where T : Request, new()
        {
            var request = XenMessage.Create <T>();

            ctx.Request = request;

            action?.Invoke(request);

            return((T)ctx.Request);
        }
Ejemplo n.º 3
0
        public static T Get <T>(this XenMessageContext ctx) where T : XenMessage
        {
            var request = ctx.Request as T;

            if (request != null)
            {
                return(request);
            }

            var response = ctx.Response as T;

            return(response);
        }