public ActionResult <T> ExecuteInSandbox <S, T>(string logMsg, S data, Func <S, T> func) { var actionResult = new ActionResult <T>(); _logger.Info(logMsg); try { actionResult.Complete(func(data)); _logger.InfoFormat(logMsg + " [Done]"); return(actionResult); } catch (Exception ex) { _logger.Error(ex); return(new ActionResult <T>().Fail("Unhandled Exception! {0}", ex.Message)); } }
public ActionResult <T> ExecuteInSandbox <R, S, T>(string logMsg, R left, S right, Func <R, S, T> func) { _logger.Info(logMsg); var actionResult = new ActionResult <T>(); try { actionResult.Complete(func(left, right)); _logger.InfoFormat(logMsg + " [Done]"); } catch (Exception ex) { _logger.Error(ex); actionResult.Fail("Unhandled Exception! {0}", ex.Message); } return(actionResult); }
public ActionResult ExecuteInSandbox <S>(string logMsg, S data, Action <S> func) { _logger.Info(logMsg); var actionResult = new ActionResult(); try { func(data); actionResult.Complete(); _logger.InfoFormat(logMsg + " [Done]"); } catch (Exception ex) { _logger.Error(ex); actionResult.Fail("Unhandled Exception! {0}", ex.Message); } return(actionResult); }