Beispiel #1
0
 /// <summary>
 /// Execute command.
 /// </summary>
 public void Execute()
 {
     _log.TraceMethodCall("Execute()", _command.CommandText);
     QueryStart();
     using (IDbConnection connection = _factory.OpenConnection(_connection)) {
         using (IDbCommand command = CreateExecutableCommand(connection)) {
             try {
                 command.ExecuteNonQuery();
             } catch (Exception e) {
                 _log.DebugFormat(e, "Execute(): Text: '{0}', Type: {1}", _command.CommandText, _command.CommandType);
                 throw;
             } finally {
                 QueryFinished(command);
             }
         }
     }
 }
Beispiel #2
0
 /// <summary>
 /// Test the read-only database connection.
 /// </summary>
 /// <param name="readonly"></param>
 public void TestConnection(bool @readonly)
 {
     using (IDbConnection testConnection = _factory.OpenConnection(@readonly ? _readonlyconnection : _connection)) {
         testConnection.Close();
     }
 }