@ -18,6 +18,34 @@ namespace Volo.Abp.Domain.Repositories
public interface IRepository < TEntity > : IReadOnlyRepository < TEntity > , IBasicRepository < TEntity >
where TEntity : class , IEntity
{
/// <summary>
/// Get a single entity by the given <paramref name="predicate"/>.
/// It returns null if no entity with the given <paramref name="predicate"/>.
/// It throws <see cref="InvalidOperationException"/> if there are multiple entities with the given <paramref name="predicate"/>.
/// </summary>
/// <param name="predicate">A condition to find the entity</param>
/// <param name="includeDetails">Set true to include all children of this entity</param>
/// <param name="cancellationToken">A <see cref="T:System.Threading.CancellationToken" /> to observe while waiting for the task to complete.</param>
Task < TEntity > FindAsync (
[NotNull] Expression < Func < TEntity , bool > > predicate ,
bool includeDetails = true ,
CancellationToken cancellationToken = default
) ;
/// <summary>
/// Get a single entity by the given <paramref name="predicate"/>.
/// It throws <see cref="EntityNotFoundException"/> if there is no entity with the given <paramref name="predicate"/>.
/// It throws <see cref="InvalidOperationException"/> if there are multiple entities with the given <paramref name="predicate"/>.
/// </summary>
/// <param name="predicate">A condition to filter entities</param>
/// <param name="includeDetails">Set true to include all children of this entity</param>
/// <param name="cancellationToken">A <see cref="T:System.Threading.CancellationToken" /> to observe while waiting for the task to complete.</param>
Task < TEntity > GetAsync (
[NotNull] Expression < Func < TEntity , bool > > predicate ,
bool includeDetails = true ,
CancellationToken cancellationToken = default
) ;
/// <summary>
/// Deletes many entities by function.
/// Notice that: All entities fits to given predicate are retrieved and deleted.
@ -30,7 +58,11 @@ namespace Volo.Abp.Domain.Repositories
/// This is useful for ORMs / database APIs those only save changes with an explicit method call, but you need to immediately save changes to the database.
/// </param>
/// <param name="cancellationToken">A <see cref="T:System.Threading.CancellationToken" /> to observe while waiting for the task to complete.</param>
Task DeleteAsync ( [ NotNull ] Expression < Func < TEntity , bool > > predicate , bool autoSave = false , CancellationToken cancellationToken = default ) ;
Task DeleteAsync (
[NotNull] Expression < Func < TEntity , bool > > predicate ,
bool autoSave = false ,
CancellationToken cancellationToken = default
) ;
}
public interface IRepository < TEntity , TKey > : IRepository < TEntity > , IReadOnlyRepository < TEntity , TKey > , IBasicRepository < TEntity , TKey >