public void AddCheckedComment(string commentID) { try { SQLCmd_AddCheckedComment.Parameters["@commentID"].Value = commentID; SQLCmd_AddCheckedComment.ExecuteNonQuery(); } catch (SQLiteException ex) when(ex.ResultCode == SQLiteErrorCode.Constraint) { throw new InvalidOperationException($"The comment {commentID} already exists in database"); } }
private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { SQLCmd_AddBotComment.Dispose(); SQLCmd_AddCheckedComment.Dispose(); SQLCmd_DoesBotCommentExist.Dispose(); SQLCmd_GetBotComment.Dispose(); SQLCmd_HasCommentBeenChecked.Dispose(); SQLCmd_HasPostBeenChecked.Dispose(); SQLCmd_AddCheckedPost.Dispose(); SQLCmd_UpdateBotComment.Dispose(); dbConnection.Dispose(); // TODO: dispose managed state (managed objects). } // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below. // TODO: set large fields to null. disposedValue = true; } }