public Apply ( |
||
cmd | ||
return | void |
public void Execute(NpgsqlCommand cmd, Action <NpgsqlCommand> action = null) { buildConnection(); RequestCount++; if (action == null) { action = c => c.ExecuteNonQuery(); } _connection.Apply(cmd); try { action(cmd); Logger.LogSuccess(cmd); } catch (NpgsqlException e) when(e.Message.IndexOf(EventContracts.UnexpectedMaxEventIdForStream, StringComparison.Ordinal) > -1) { Logger.LogFailure(cmd, e); throw new EventStreamUnexpectedMaxEventIdException(e); } catch (NpgsqlException e) { Logger.LogFailure(cmd, e); throw new MartenCommandException(cmd, e); } catch (Exception e) { Logger.LogFailure(cmd, e); throw; } }
public int Execute(NpgsqlCommand cmd) { buildConnection(); RequestCount++; _connection.Apply(cmd); try { var returnValue = _retryPolicy.Execute(cmd.ExecuteNonQuery); Logger.LogSuccess(cmd); return(returnValue); } catch (Exception e) { handleCommandException(cmd, e); throw; } }
public void Execute(NpgsqlCommand cmd, Action <NpgsqlCommand> action = null) { buildConnection(); RequestCount++; if (action == null) { action = c => c.ExecuteNonQuery(); } _connection.Apply(cmd); try { _retryPolicy.Execute(() => action(cmd)); Logger.LogSuccess(cmd); } catch (Exception e) { handleCommandException(cmd, e); throw; } }