/// <summary> /// Delete entity in table "Ts" by an un-parameterized WHERE clause. /// If you want to Delete All of the data, call the DeleteAll() command /// </summary> /// <typeparam name="T"></typeparam> /// <param name="whereClause">The where clause to use to bound a delete, cannot be null, empty, or whitespace</param> /// <returns> /// True if deleted, false if not found. /// </returns> public bool Delete <T>(string whereClause) where T : class { if (string.IsNullOrWhiteSpace(whereClause)) { throw new ArgumentNullException(nameof(whereClause), "Must specify a where clause for deletion."); } return(ExecuteInternal(() => SharedConnection.Delete <T>(whereClause, _transaction, OneTimeCommandTimeout ?? CommandTimeout))); }
/// <summary> /// Delete entity in table "Ts" by a primary key value specified on (T) /// </summary> /// <typeparam name="T"></typeparam> /// <param name="primaryKeyValue">a Single primary key to delete</param> /// <returns> /// True if deleted, false if not found. /// </returns> public bool Delete <T>(object primaryKeyValue) where T : class => ExecuteInternal(() => SharedConnection.Delete <T>(primaryKeyValue, _transaction, OneTimeCommandTimeout ?? CommandTimeout));
/// <summary> /// Delete entity in table "Ts" that match the key values of the entity (T) passed in /// </summary> /// <typeparam name="T">Type of entity</typeparam> /// <param name="entityToDelete"> /// Entity to delete. If Keys are specified, they will be used as the WHERE condition to /// delete. /// </param> /// <returns> /// True if deleted, false if not found. /// </returns> public bool Delete <T>(T entityToDelete) where T : class => ExecuteInternal(() => SharedConnection.Delete(entityToDelete, _transaction, OneTimeCommandTimeout ?? CommandTimeout));