Class EfCoreRepository<TDbContext, TEntity>
Inheritance
object
EfCoreRepository<TDbContext, TEntity>
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Assembly: Volo.Abp.EntityFrameworkCore.dll
Syntax
public class EfCoreRepository<TDbContext, TEntity> : RepositoryBase<TEntity>, IServiceProviderAccessor, IUnitOfWorkEnabled, IUnitOfWorkManagerAccessor, IEfCoreRepository<TEntity>, IRepository<TEntity>, IReadOnlyRepository<TEntity>, IBasicRepository<TEntity>, IReadOnlyBasicRepository<TEntity>, IRepository where TDbContext : IEfCoreDbContext where TEntity : class, IEntity
Type Parameters
| Name |
Description |
| TDbContext |
|
| TEntity |
|
Constructors
EfCoreRepository(IDbContextProvider<TDbContext>)
Declaration
public EfCoreRepository(IDbContextProvider<TDbContext> dbContextProvider)
Parameters
Properties
AbpEntityOptions
Declaration
protected virtual AbpEntityOptions<TEntity> AbpEntityOptions { get; }
Property Value
BulkOperationProvider
Declaration
public IEfCoreBulkOperationProvider BulkOperationProvider { get; }
Property Value
DbContext
Declaration
[Obsolete("Use GetDbContextAsync() method.")]
protected virtual TDbContext DbContext { get; }
Property Value
| Type |
Description |
| TDbContext |
|
DbSet
Declaration
[Obsolete("Use GetDbSetAsync() method.")]
public virtual DbSet<TEntity> DbSet { get; }
Property Value
| Type |
Description |
| Microsoft.EntityFrameworkCore.DbSet<><TEntity> |
|
GuidGenerator
Declaration
public virtual IGuidGenerator GuidGenerator { get; }
Property Value
Methods
CheckAndSetId(TEntity)
Declaration
protected virtual void CheckAndSetId(TEntity entity)
Parameters
| Type |
Name |
Description |
| TEntity |
entity |
|
DeleteAsync(TEntity, bool, CancellationToken)
Declaration
public override Task DeleteAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
Parameters
| Type |
Name |
Description |
| TEntity |
entity |
|
| bool |
autoSave |
|
| System.Threading.CancellationToken |
cancellationToken |
|
Returns
| Type |
Description |
| System.Threading.Tasks.Task |
|
Overrides
Volo.Abp.Domain.Repositories.BasicRepositoryBase<TEntity>.DeleteAsync(TEntity, bool, System.Threading.CancellationToken)
DeleteAsync(Expression<Func<TEntity, bool>>, bool, CancellationToken)
Declaration
public override Task DeleteAsync(Expression<Func<TEntity, bool>> predicate, bool autoSave = false, CancellationToken cancellationToken = default)
Parameters
| Type |
Name |
Description |
| System.Linq.Expressions.Expression<TDelegate><System.Func<T, TResult><TEntity, bool>> |
predicate |
|
| bool |
autoSave |
|
| System.Threading.CancellationToken |
cancellationToken |
|
Returns
| Type |
Description |
| System.Threading.Tasks.Task |
|
Overrides
Volo.Abp.Domain.Repositories.RepositoryBase<TEntity>.DeleteAsync(System.Linq.Expressions.Expression<System.Func<TEntity, bool>>, bool, System.Threading.CancellationToken)
DeleteManyAsync(IEnumerable<TEntity>, bool, CancellationToken)
Declaration
public override Task DeleteManyAsync(IEnumerable<TEntity> entities, bool autoSave = false, CancellationToken cancellationToken = default)
Parameters
| Type |
Name |
Description |
| System.Collections.Generic.IEnumerable<T><TEntity> |
entities |
|
| bool |
autoSave |
|
| System.Threading.CancellationToken |
cancellationToken |
|
Returns
| Type |
Description |
| System.Threading.Tasks.Task |
|
Overrides
Volo.Abp.Domain.Repositories.BasicRepositoryBase<TEntity>.DeleteManyAsync(System.Collections.Generic.IEnumerable<TEntity>, bool, System.Threading.CancellationToken)
EnsureCollectionLoadedAsync<TProperty>(TEntity, Expression<Func<TEntity, IEnumerable<TProperty>>>, CancellationToken)
Declaration
public virtual Task EnsureCollectionLoadedAsync<TProperty>(TEntity entity, Expression<Func<TEntity, IEnumerable<TProperty>>> propertyExpression, CancellationToken cancellationToken = default) where TProperty : class
Parameters
| Type |
Name |
Description |
| TEntity |
entity |
|
| System.Linq.Expressions.Expression<TDelegate><System.Func<T, TResult><TEntity, System.Collections.Generic.IEnumerable<T><TProperty>>> |
propertyExpression |
|
| System.Threading.CancellationToken |
cancellationToken |
|
Returns
| Type |
Description |
| System.Threading.Tasks.Task |
|
Type Parameters
| Name |
Description |
| TProperty |
|
EnsurePropertyLoadedAsync<TProperty>(TEntity, Expression<Func<TEntity, TProperty>>, CancellationToken)
Declaration
public virtual Task EnsurePropertyLoadedAsync<TProperty>(TEntity entity, Expression<Func<TEntity, TProperty>> propertyExpression, CancellationToken cancellationToken = default) where TProperty : class
Parameters
| Type |
Name |
Description |
| TEntity |
entity |
|
| System.Linq.Expressions.Expression<TDelegate><System.Func<T, TResult><TEntity, TProperty>> |
propertyExpression |
|
| System.Threading.CancellationToken |
cancellationToken |
|
Returns
| Type |
Description |
| System.Threading.Tasks.Task |
|
Type Parameters
| Name |
Description |
| TProperty |
|
FindAsync(Expression<Func<TEntity, bool>>, bool, CancellationToken)
Declaration
public override Task<TEntity> FindAsync(Expression<Func<TEntity, bool>> predicate, bool includeDetails = true, CancellationToken cancellationToken = default)
Parameters
| Type |
Name |
Description |
| System.Linq.Expressions.Expression<TDelegate><System.Func<T, TResult><TEntity, bool>> |
predicate |
|
| bool |
includeDetails |
|
| System.Threading.CancellationToken |
cancellationToken |
|
Returns
| Type |
Description |
| System.Threading.Tasks.Task<TResult><TEntity> |
|
Overrides
Volo.Abp.Domain.Repositories.RepositoryBase<TEntity>.FindAsync(System.Linq.Expressions.Expression<System.Func<TEntity, bool>>, bool, System.Threading.CancellationToken)
GetCountAsync(CancellationToken)
Declaration
public override Task<long> GetCountAsync(CancellationToken cancellationToken = default)
Parameters
| Type |
Name |
Description |
| System.Threading.CancellationToken |
cancellationToken |
|
Returns
| Type |
Description |
| System.Threading.Tasks.Task<TResult><long> |
|
Overrides
Volo.Abp.Domain.Repositories.BasicRepositoryBase<TEntity>.GetCountAsync(System.Threading.CancellationToken)
GetDbContextAsync()
Declaration
protected virtual Task<TDbContext> GetDbContextAsync()
Returns
| Type |
Description |
| System.Threading.Tasks.Task<TResult><TDbContext> |
|
GetDbSetAsync()
Declaration
protected Task<DbSet<TEntity>> GetDbSetAsync()
Returns
| Type |
Description |
| System.Threading.Tasks.Task<TResult><Microsoft.EntityFrameworkCore.DbSet<><TEntity>> |
|
GetListAsync(bool, CancellationToken)
Declaration
public override Task<List<TEntity>> GetListAsync(bool includeDetails = false, CancellationToken cancellationToken = default)
Parameters
| Type |
Name |
Description |
| bool |
includeDetails |
|
| System.Threading.CancellationToken |
cancellationToken |
|
Returns
| Type |
Description |
| System.Threading.Tasks.Task<TResult><System.Collections.Generic.List<T><TEntity>> |
|
Overrides
Volo.Abp.Domain.Repositories.BasicRepositoryBase<TEntity>.GetListAsync(bool, System.Threading.CancellationToken)
GetListAsync(Expression<Func<TEntity, bool>>, bool, CancellationToken)
Declaration
public override Task<List<TEntity>> GetListAsync(Expression<Func<TEntity, bool>> predicate, bool includeDetails = false, CancellationToken cancellationToken = default)
Parameters
| Type |
Name |
Description |
| System.Linq.Expressions.Expression<TDelegate><System.Func<T, TResult><TEntity, bool>> |
predicate |
|
| bool |
includeDetails |
|
| System.Threading.CancellationToken |
cancellationToken |
|
Returns
| Type |
Description |
| System.Threading.Tasks.Task<TResult><System.Collections.Generic.List<T><TEntity>> |
|
Overrides
Volo.Abp.Domain.Repositories.BasicRepositoryBase<TEntity>.GetListAsync(System.Linq.Expressions.Expression<System.Func<TEntity, bool>>, bool, System.Threading.CancellationToken)
GetPagedListAsync(int, int, string, bool, CancellationToken)
Declaration
public override Task<List<TEntity>> GetPagedListAsync(int skipCount, int maxResultCount, string sorting, bool includeDetails = false, CancellationToken cancellationToken = default)
Parameters
| Type |
Name |
Description |
| int |
skipCount |
|
| int |
maxResultCount |
|
| string |
sorting |
|
| bool |
includeDetails |
|
| System.Threading.CancellationToken |
cancellationToken |
|
Returns
| Type |
Description |
| System.Threading.Tasks.Task<TResult><System.Collections.Generic.List<T><TEntity>> |
|
Overrides
Volo.Abp.Domain.Repositories.BasicRepositoryBase<TEntity>.GetPagedListAsync(int, int, string, bool, System.Threading.CancellationToken)
GetQueryable()
Declaration
[Obsolete("Use GetQueryableAsync method.")]
protected override IQueryable<TEntity> GetQueryable()
Returns
| Type |
Description |
| System.Linq.IQueryable<T><TEntity> |
|
Overrides
Volo.Abp.Domain.Repositories.RepositoryBase<TEntity>.GetQueryable()
GetQueryableAsync()
Declaration
public override Task<IQueryable<TEntity>> GetQueryableAsync()
Returns
| Type |
Description |
| System.Threading.Tasks.Task<TResult><System.Linq.IQueryable<T><TEntity>> |
|
Overrides
Volo.Abp.Domain.Repositories.RepositoryBase<TEntity>.GetQueryableAsync()
InsertAsync(TEntity, bool, CancellationToken)
Declaration
public override Task<TEntity> InsertAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
Parameters
| Type |
Name |
Description |
| TEntity |
entity |
|
| bool |
autoSave |
|
| System.Threading.CancellationToken |
cancellationToken |
|
Returns
| Type |
Description |
| System.Threading.Tasks.Task<TResult><TEntity> |
|
Overrides
Volo.Abp.Domain.Repositories.BasicRepositoryBase<TEntity>.InsertAsync(TEntity, bool, System.Threading.CancellationToken)
InsertManyAsync(IEnumerable<TEntity>, bool, CancellationToken)
Declaration
public override Task InsertManyAsync(IEnumerable<TEntity> entities, bool autoSave = false, CancellationToken cancellationToken = default)
Parameters
| Type |
Name |
Description |
| System.Collections.Generic.IEnumerable<T><TEntity> |
entities |
|
| bool |
autoSave |
|
| System.Threading.CancellationToken |
cancellationToken |
|
Returns
| Type |
Description |
| System.Threading.Tasks.Task |
|
Overrides
Volo.Abp.Domain.Repositories.BasicRepositoryBase<TEntity>.InsertManyAsync(System.Collections.Generic.IEnumerable<TEntity>, bool, System.Threading.CancellationToken)
SaveChangesAsync(CancellationToken)
Declaration
protected override Task SaveChangesAsync(CancellationToken cancellationToken)
Parameters
| Type |
Name |
Description |
| System.Threading.CancellationToken |
cancellationToken |
|
Returns
| Type |
Description |
| System.Threading.Tasks.Task |
|
Overrides
Volo.Abp.Domain.Repositories.BasicRepositoryBase<TEntity>.SaveChangesAsync(System.Threading.CancellationToken)
TrySetGuidId(IEntity<Guid>)
Declaration
protected virtual void TrySetGuidId(IEntity<Guid> entity)
Parameters
| Type |
Name |
Description |
| IEntity<System.Guid> |
entity |
|
UpdateAsync(TEntity, bool, CancellationToken)
Declaration
public override Task<TEntity> UpdateAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
Parameters
| Type |
Name |
Description |
| TEntity |
entity |
|
| bool |
autoSave |
|
| System.Threading.CancellationToken |
cancellationToken |
|
Returns
| Type |
Description |
| System.Threading.Tasks.Task<TResult><TEntity> |
|
Overrides
Volo.Abp.Domain.Repositories.BasicRepositoryBase<TEntity>.UpdateAsync(TEntity, bool, System.Threading.CancellationToken)
UpdateManyAsync(IEnumerable<TEntity>, bool, CancellationToken)
Declaration
public override Task UpdateManyAsync(IEnumerable<TEntity> entities, bool autoSave = false, CancellationToken cancellationToken = default)
Parameters
| Type |
Name |
Description |
| System.Collections.Generic.IEnumerable<T><TEntity> |
entities |
|
| bool |
autoSave |
|
| System.Threading.CancellationToken |
cancellationToken |
|
Returns
| Type |
Description |
| System.Threading.Tasks.Task |
|
Overrides
Volo.Abp.Domain.Repositories.BasicRepositoryBase<TEntity>.UpdateManyAsync(System.Collections.Generic.IEnumerable<TEntity>, bool, System.Threading.CancellationToken)
WithDetails()
Declaration
[Obsolete("Use WithDetailsAsync")]
public override IQueryable<TEntity> WithDetails()
Returns
| Type |
Description |
| System.Linq.IQueryable<T><TEntity> |
|
Overrides
Volo.Abp.Domain.Repositories.RepositoryBase<TEntity>.WithDetails()
WithDetails(params Expression<Func<TEntity, object>>[])
Declaration
[Obsolete("Use WithDetailsAsync method.")]
public override IQueryable<TEntity> WithDetails(params Expression<Func<TEntity, object>>[] propertySelectors)
Parameters
| Type |
Name |
Description |
| System.Linq.Expressions.Expression<TDelegate><System.Func<T, TResult><TEntity, object>>[] |
propertySelectors |
|
Returns
| Type |
Description |
| System.Linq.IQueryable<T><TEntity> |
|
Overrides
Volo.Abp.Domain.Repositories.RepositoryBase<TEntity>.WithDetails(params System.Linq.Expressions.Expression<System.Func<TEntity, object>>[])
WithDetailsAsync()
Declaration
public override Task<IQueryable<TEntity>> WithDetailsAsync()
Returns
| Type |
Description |
| System.Threading.Tasks.Task<TResult><System.Linq.IQueryable<T><TEntity>> |
|
Overrides
Volo.Abp.Domain.Repositories.RepositoryBase<TEntity>.WithDetailsAsync()
WithDetailsAsync(params Expression<Func<TEntity, object>>[])
Declaration
public override Task<IQueryable<TEntity>> WithDetailsAsync(params Expression<Func<TEntity, object>>[] propertySelectors)
Parameters
| Type |
Name |
Description |
| System.Linq.Expressions.Expression<TDelegate><System.Func<T, TResult><TEntity, object>>[] |
propertySelectors |
|
Returns
| Type |
Description |
| System.Threading.Tasks.Task<TResult><System.Linq.IQueryable<T><TEntity>> |
|
Overrides
Volo.Abp.Domain.Repositories.RepositoryBase<TEntity>.WithDetailsAsync(params System.Linq.Expressions.Expression<System.Func<TEntity, object>>[])
Implements
Extension Methods