internal static Task <int> DeleteByIdAsync <T>(this IDbCommand dbCmd, object id, CancellationToken token) { OrmLiteUtils.AssertNotAnonType <T>(); var sql = dbCmd.DeleteByIdSql <T>(id); return(dbCmd.ExecuteSqlAsync(sql, token)); }
internal static async Task DeleteByIdAsync <T>(this IDbCommand dbCmd, object id, ulong rowVersion, CancellationToken token) { var sql = dbCmd.DeleteByIdSql <T>(id, rowVersion); var rowsAffected = await dbCmd.ExecuteSqlAsync(sql, token); if (rowsAffected == 0) { throw new OptimisticConcurrencyException("The row was modified or deleted since the last read"); } }
internal static async Task DeleteByIdAsync<T>(this IDbCommand dbCmd, object id, ulong rowVersion, Action<IDbCommand> commandFilter, CancellationToken token) { OrmLiteUtils.AssertNotAnonType<T>(); var sql = dbCmd.DeleteByIdSql<T>(id, rowVersion); var rowsAffected = await dbCmd.ExecuteSqlAsync(sql, commandFilter, token); if (rowsAffected == 0) throw new OptimisticConcurrencyException("The row was modified or deleted since the last read"); }
internal static Task DeleteByIdAsync <T>(this IDbCommand dbCmd, object id, ulong rowVersion, CancellationToken token) { var sql = dbCmd.DeleteByIdSql <T>(id, rowVersion); return(dbCmd.ExecuteSqlAsync(sql, token).Then(rowsAffected => { if (rowsAffected == 0) { throw new OptimisticConcurrencyException("The row was modified or deleted since the last read"); } return TaskResult.Finished; })); }
internal static Task <int> DeleteByIdAsync <T>(this IDbCommand dbCmd, object id, CancellationToken token) { var sql = dbCmd.DeleteByIdSql <T>(id); return(dbCmd.ExecuteSqlAsync(sql, token)); }