public void DeleteMessage(Message message) { try { SqlParameter[] sqlParameters = new SqlParameter[] { new SqlParameter(MessageParameter.ID, DbValueUtil.GetValidValue(message.Id)) }; string sqlQuery = string.Format("DELETE FROM {0} WHERE {1} = {2}", TableName, MessageColumn.ID, MessageParameter.ID); using (MssqlDbEngine mssqlDbEngine = GetMssqlDbEngine(sqlQuery, sqlParameters, connectionString)) { mssqlDbEngine.ExecuteQuery(); } } catch (Exception exception) { string eMessage = string.Format("Error encountered when executing {0} function in MessageRepositoryMsSql. Error\n{1}", "DeleteMessage", exception.Message); WriteErrorLog(eMessage); throw; } }
protected object GetDBValue(object value) { return(DbValueUtil.GetValidValue(value)); }