Interface IRepository<TEntity>
Inherited Members
Namespace: Volo.Abp.Domain.Repositories
Assembly: Volo.Abp.Ddd.Domain.dll
Syntax
public interface IRepository<TEntity> : IReadOnlyRepository<TEntity>, IQueryable<TEntity>, IBasicRepository<TEntity>, IReadOnlyBasicRepository<TEntity>, IRepository where TEntity : class, IEntity
Type Parameters
| Name | Description |
|---|---|
| TEntity |
Methods
DeleteAsync(Expression<Func<TEntity, Boolean>>, Boolean, CancellationToken)
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.
Declaration
Task DeleteAsync(Expression<Func<TEntity, bool>> predicate, bool autoSave = false, CancellationToken cancellationToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression<Func<TEntity, System.Boolean>> | predicate | A condition to filter entities |
| System.Boolean | autoSave | Set true to automatically save changes to database. 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. |
| CancellationToken | cancellationToken | A System.Threading.CancellationToken to observe while waiting for the task to complete. |
Returns
| Type | Description |
|---|---|
| Task |
FindAsync(Expression<Func<TEntity, Boolean>>, Boolean, CancellationToken)
Get a single entity by the given predicate.
It returns null if no entity with the given predicate.
It throws predicate.
Declaration
Task<TEntity> FindAsync(Expression<Func<TEntity, bool>> predicate, bool includeDetails = true, CancellationToken cancellationToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression<Func<TEntity, System.Boolean>> | predicate | A condition to find the entity |
| System.Boolean | includeDetails | Set true to include all children of this entity |
| CancellationToken | cancellationToken | A System.Threading.CancellationToken to observe while waiting for the task to complete. |
Returns
| Type | Description |
|---|---|
| Task<TEntity> |
GetAsync(Expression<Func<TEntity, Boolean>>, Boolean, CancellationToken)
Get a single entity by the given predicate.
It throws EntityNotFoundException if there is no entity with the given predicate.
It throws predicate.
Declaration
Task<TEntity> GetAsync(Expression<Func<TEntity, bool>> predicate, bool includeDetails = true, CancellationToken cancellationToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression<Func<TEntity, System.Boolean>> | predicate | A condition to filter entities |
| System.Boolean | includeDetails | Set true to include all children of this entity |
| CancellationToken | cancellationToken | A System.Threading.CancellationToken to observe while waiting for the task to complete. |
Returns
| Type | Description |
|---|---|
| Task<TEntity> |