コード例 #1
0
 public static void SetVoid(this RdEndpoint <Unit, Unit> endpoint, Action handler)
 {
     endpoint.Set(req =>
     {
         handler();
         return(Unit.Instance);
     });
 }
コード例 #2
0
 public static void SetVoid <TReq>(this RdEndpoint <TReq, Unit> endpoint, Action <TReq> handler)
 {
     endpoint.Set(req =>
     {
         handler(req);
         return(Unit.Instance);
     });
 }
コード例 #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;
         }
     });
 }
コード例 #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;
         }
     });
 }
コード例 #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));
 }
コード例 #6
0
 public static void SetVoid <TRes>(this RdEndpoint <Unit, TRes> endpoint, Func <TRes> handler)
 {
     endpoint.Set(req => handler());
 }