コード例 #1
0
        public int ExecuteDbNonQueryCommand(IDbNonQueryCommand dbNonQueryCommand)
        {
            try
            {
                _logger?.Log(dbNonQueryCommand.Statement);

                if (dbNonQueryCommand.Statement == null)
                {
                    return(0);                                     //maybe throw ?
                }
                MySqlCommand mySqlCommand = new MySqlCommand(dbNonQueryCommand.Statement, _connection);
                return(mySqlCommand.ExecuteNonQuery());
            }
            catch (Exception ex)
            {
                _logger?.Log(ex.Message);
                throw ex;
            }
        }
コード例 #2
0
 public int ExecuteDbNonQueryCommand <T>(IDbNonQueryCommand <T> dbNonQueryCommand)
     where T : IDataObject
 {
     try
     {
         if (dbNonQueryCommand.DataObjects == null || dbNonQueryCommand.DataObjects.Count() == 0)
         {
             return(0);                                                                                     //maybe throw ?
         }
         _logger?.Log(dbNonQueryCommand.Statement);
         MySqlCommand mySqlCommand = new MySqlCommand(dbNonQueryCommand.Statement, _connection);
         return(mySqlCommand.ExecuteNonQuery());
     }
     catch (Exception ex)
     {
         _logger?.Log(ex.Message);
         throw ex;
     }
 }