/// <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 async Task <bool> DeleteAsync <T>(string whereClause) where T : class { if (string.IsNullOrWhiteSpace(whereClause)) { throw new ArgumentNullException(nameof(whereClause), "Must specify a where clause for deletion."); } return(await ExecuteInternalAsync(() => SharedConnection.DeleteAsync <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 async Task <bool> DeleteAsync <T>(object primaryKeyValue) where T : class => await ExecuteInternalAsync( () => SharedConnection.DeleteAsync <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 async Task <bool> DeleteAsync <T>(T entityToDelete) where T : class => await ExecuteInternalAsync(() => SharedConnection.DeleteAsync(entityToDelete, _transaction, OneTimeCommandTimeout ?? CommandTimeout));