protected ServiceResponse <T> ExecuteService <T>(Func <ServiceResponse <T>, T> func, T defaultValue = default(T)) { var response = new ServiceResponse <T>(); var result = defaultValue; try { result = func(response); response.Value = result; } catch (Exception ex) { response.Error = ex; response.Value = defaultValue; SkExceptionHandler.HandleServiceException(ex); } return(response); }
protected DataAccessResult <T> ExecuteAdataAccess <T>(Func <DataAccessResult <T>, T> func, T defaultValue = default(T)) { var response = new DataAccessResult <T>(); var result = defaultValue; try { result = func(response); response.Value = result; } catch (Exception ex) { response.Error = ex; response.Value = defaultValue; SkExceptionHandler.HandleDataAccessException(ex); } return(response); }