public static void SetVoid(this RdEndpoint <Unit, Unit> endpoint, Action handler) { endpoint.Set(req => { handler(); return(Unit.Instance); }); }
public static void SetVoid <TReq>(this RdEndpoint <TReq, Unit> endpoint, Action <TReq> handler) { endpoint.Set(req => { handler(req); return(Unit.Instance); }); }
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; } }); }
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; } }); }
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)); }
public static void SetVoid <TRes>(this RdEndpoint <Unit, TRes> endpoint, Func <TRes> handler) { endpoint.Set(req => handler()); }