Exemplo n.º 1
0
 public static void SetVoid(this RdEndpoint <Unit, Unit> endpoint, Action handler)
 {
     endpoint.Set(req =>
     {
         handler();
         return(Unit.Instance);
     });
 }
Exemplo n.º 2
0
 public static void SetVoid <TReq>(this RdEndpoint <TReq, Unit> endpoint, Action <TReq> handler)
 {
     endpoint.Set(req =>
     {
         handler(req);
         return(Unit.Instance);
     });
 }
Exemplo n.º 3
0
 public static void SetAndLogErrors <TReq, TRes>(this RdEndpoint <TReq, TRes> endpoint, Func <TReq, TRes> handler, ILog logger)
 {
     endpoint.Set(req =>
     {
         try
         {
             return(handler(req));
         }
         catch (Exception ex)
         {
             logger.Error(ex);
             throw;
         }
     });
 }
Exemplo n.º 4
0
 public static void SetAndLogErrors <TReq, TRes>(this RdEndpoint <TReq, TRes> endpoint, Action <TReq, RdTask <TRes> > handler, ILog logger)
 {
     endpoint.Set((lifetime, req) =>
     {
         try
         {
             var task = new RdTask <TRes>();
             handler(req, task);
             return(task);
         }
         catch (Exception ex)
         {
             logger.Error(ex);
             throw;
         }
     });
 }
Exemplo n.º 5
0
 public static void Set <TReq, TRes>(this RdEndpoint <TReq, TRes> endpoint, Func <Lifetime, TReq, Task <TRes> > handler)
 {
     endpoint.Set((lt, req) => handler(lt, req).ToRdTask(lt));
 }
Exemplo n.º 6
0
 public static void SetVoid <TRes>(this RdEndpoint <Unit, TRes> endpoint, Func <TRes> handler)
 {
     endpoint.Set(req => handler());
 }