From bf5c64e768c20af27b1aec52030ff1cfb62120b0 Mon Sep 17 00:00:00 2001 From: Oliver Cooper Date: Sun, 31 Jan 2021 02:35:56 +0000 Subject: [PATCH] Add IRepository.DeleteManyAsync declaration --- .../Abp/Domain/Repositories/IRepository.cs | 23 +++++++++++++++---- .../Abp/Domain/Repositories/RepositoryBase.cs | 5 +--- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IRepository.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IRepository.cs index 3bda51bd2e..ec79597396 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IRepository.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IRepository.cs @@ -20,8 +20,10 @@ namespace Volo.Abp.Domain.Repositories { /// /// Get a single entity by the given . - /// It returns null if no entity with the given . + /// + /// It returns null if there is no entity with the given . /// It throws if there are multiple entities with the given . + /// /// /// A condition to find the entity /// Set true to include all children of this entity @@ -34,8 +36,10 @@ namespace Volo.Abp.Domain.Repositories /// /// Get a single entity by the given . + /// /// It throws if there is no entity with the given . /// It throws if there are multiple entities with the given . + /// /// /// A condition to filter entities /// Set true to include all children of this entity @@ -47,10 +51,11 @@ namespace Volo.Abp.Domain.Repositories ); /// - /// Deletes many entities by function. - /// Notice that: All entities fits to given predicate are retrieved and deleted. - /// This may cause major performance problems if there are too many entities with - /// given predicate. + /// Deletes many entities by the given . + /// + /// Please note: This may cause major performance problems if there are too many entities returned for a + /// given predicate and the database provider doesn't have a way to efficiently delete many entities. + /// /// /// A condition to filter entities /// @@ -63,6 +68,14 @@ namespace Volo.Abp.Domain.Repositories bool autoSave = false, CancellationToken cancellationToken = default ); + + /// + /// This is an alias for + Task DeleteManyAsync( + [NotNull] Expression> predicate, + bool autoSave = false, + CancellationToken cancellationToken = default + ); } public interface IRepository : IRepository, IReadOnlyRepository, IBasicRepository diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryBase.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryBase.cs index d1bf2aa754..5ba522ef00 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryBase.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryBase.cs @@ -85,10 +85,7 @@ namespace Volo.Abp.Domain.Repositories public abstract Task DeleteAsync(Expression> predicate, bool autoSave = false, CancellationToken cancellationToken = default); - public virtual Task DeleteManyAsync( - Expression> predicate, - bool autoSave = false, - CancellationToken cancellationToken = default) + public virtual Task DeleteManyAsync(Expression> predicate, bool autoSave = false, CancellationToken cancellationToken = default) => DeleteAsync(predicate, autoSave, cancellationToken); protected virtual TQueryable ApplyDataFilters(TQueryable query)