public IEnumerable <Task.DTO.CommentDTO> FetchAll(CommentCriteria criteria) { try { using (var connection = ConnectionBuilder.GetOpenedConnection()) { using (var transaction = connection.BeginTransaction()) { var result = ExecuteFetch(criteria, transaction); transaction.Commit(); return(result); } } } catch (Exception e) { return(null); } }
public static void DoTransactional(Action <SqlTransaction> action) { try { using (var connection = ConnectionBuilder.GetOpenedConnection()) { using (var transaction = connection.BeginTransaction()) { action.Invoke(transaction); transaction.Commit(); } } } catch (Exception e) { //TODO: Log throw; } }