Class EfCoreRepository<TDbContext, TEntity>
Inheritance
System.Object
EfCoreRepository<TDbContext, TEntity>
Implements
IServiceProviderAccessor
ITransientDependency
IQueryable<TEntity>
IAsyncEnumerable<TEntity>
Inherited Members
Volo.Abp.Domain.Repositories.RepositoryBase<TEntity>.WithDetails(Expression<>[])
Volo.Abp.Domain.Repositories.RepositoryBase<TEntity>.FindAsync(Expression<>, System.Boolean, CancellationToken)
Volo.Abp.Domain.Repositories.RepositoryBase<TEntity>.GetAsync(Expression<>, System.Boolean, CancellationToken)
Volo.Abp.Domain.Repositories.RepositoryBase<TEntity>.DeleteAsync(Expression<>, System.Boolean, CancellationToken)
Assembly: Volo.Abp.EntityFrameworkCore.dll
Syntax
public class EfCoreRepository<TDbContext, TEntity> : RepositoryBase<TEntity>, IServiceProviderAccessor, IUnitOfWorkEnabled, ITransientDependency, IUnitOfWorkManagerAccessor, IEfCoreRepository<TEntity>, IRepository<TEntity>, IReadOnlyRepository<TEntity>, IQueryable<TEntity>, IBasicRepository<TEntity>, IReadOnlyBasicRepository<TEntity>, IRepository, IAsyncEnumerable<TEntity> 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
DbContext
Declaration
protected virtual TDbContext DbContext { get; }
Property Value
Type |
Description |
TDbContext |
|
DbSet
Declaration
public virtual DbSet<TEntity> DbSet { get; }
Property Value
Type |
Description |
DbSet<TEntity> |
|
GuidGenerator
Declaration
protected virtual IGuidGenerator GuidGenerator { get; set; }
Property Value
Type |
Description |
IGuidGenerator |
|
Methods
CheckAndSetId(TEntity)
Declaration
protected virtual void CheckAndSetId(TEntity entity)
Parameters
Type |
Name |
Description |
TEntity |
entity |
|
DeleteAsync(TEntity, Boolean, CancellationToken)
Declaration
public override Task DeleteAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = null)
Parameters
Type |
Name |
Description |
TEntity |
entity |
|
System.Boolean |
autoSave |
|
CancellationToken |
cancellationToken |
|
Returns
DeleteAsync(Expression<Func<TEntity, Boolean>>, Boolean, CancellationToken)
Declaration
public override Task DeleteAsync(Expression<Func<TEntity, bool>> predicate, bool autoSave = false, CancellationToken cancellationToken = null)
Parameters
Type |
Name |
Description |
Expression<Func<TEntity, System.Boolean>> |
predicate |
|
System.Boolean |
autoSave |
|
CancellationToken |
cancellationToken |
|
Returns
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 = null)
where TProperty : class
Parameters
Type |
Name |
Description |
TEntity |
entity |
|
Expression<Func<TEntity, IEnumerable<TProperty>>> |
propertyExpression |
|
CancellationToken |
cancellationToken |
|
Returns
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 = null)
where TProperty : class
Parameters
Type |
Name |
Description |
TEntity |
entity |
|
Expression<Func<TEntity, TProperty>> |
propertyExpression |
|
CancellationToken |
cancellationToken |
|
Returns
Type Parameters
Name |
Description |
TProperty |
|
FindAsync(Expression<Func<TEntity, Boolean>>, Boolean, CancellationToken)
Declaration
public override Task<TEntity> FindAsync(Expression<Func<TEntity, bool>> predicate, bool includeDetails = true, CancellationToken cancellationToken = null)
Parameters
Type |
Name |
Description |
Expression<Func<TEntity, System.Boolean>> |
predicate |
|
System.Boolean |
includeDetails |
|
CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
Task<TEntity> |
|
GetAsyncEnumerator(CancellationToken)
Declaration
public IAsyncEnumerator<TEntity> GetAsyncEnumerator(CancellationToken cancellationToken = null)
Parameters
Type |
Name |
Description |
CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
IAsyncEnumerator<TEntity> |
|
GetCountAsync(CancellationToken)
Declaration
public override Task<long> GetCountAsync(CancellationToken cancellationToken = null)
Parameters
Type |
Name |
Description |
CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
Task<System.Int64> |
|
GetListAsync(Boolean, CancellationToken)
Declaration
public override Task<List<TEntity>> GetListAsync(bool includeDetails = false, CancellationToken cancellationToken = null)
Parameters
Type |
Name |
Description |
System.Boolean |
includeDetails |
|
CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
Task<List<TEntity>> |
|
GetPagedListAsync(Int32, Int32, String, Boolean, CancellationToken)
Declaration
public override Task<List<TEntity>> GetPagedListAsync(int skipCount, int maxResultCount, string sorting, bool includeDetails = false, CancellationToken cancellationToken = null)
Parameters
Type |
Name |
Description |
System.Int32 |
skipCount |
|
System.Int32 |
maxResultCount |
|
System.String |
sorting |
|
System.Boolean |
includeDetails |
|
CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
Task<List<TEntity>> |
|
GetQueryable()
Declaration
protected override IQueryable<TEntity> GetQueryable()
Returns
Type |
Description |
IQueryable<TEntity> |
|
Overrides
Volo.Abp.Domain.Repositories.RepositoryBase<TEntity>.GetQueryable()
InsertAsync(TEntity, Boolean, CancellationToken)
Declaration
public override Task<TEntity> InsertAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = null)
Parameters
Type |
Name |
Description |
TEntity |
entity |
|
System.Boolean |
autoSave |
|
CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
Task<TEntity> |
|
TrySetGuidId(IEntity<Guid>)
Declaration
protected virtual void TrySetGuidId(IEntity<Guid> entity)
Parameters
Type |
Name |
Description |
IEntity<Guid> |
entity |
|
UpdateAsync(TEntity, Boolean, CancellationToken)
Declaration
public override Task<TEntity> UpdateAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = null)
Parameters
Type |
Name |
Description |
TEntity |
entity |
|
System.Boolean |
autoSave |
|
CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
Task<TEntity> |
|
WithDetails()
Declaration
public override IQueryable<TEntity> WithDetails()
Returns
Type |
Description |
IQueryable<TEntity> |
|
Overrides
Volo.Abp.Domain.Repositories.RepositoryBase<TEntity>.WithDetails()
WithDetails(Expression<Func<TEntity, Object>>[])
Declaration
public override IQueryable<TEntity> WithDetails(params Expression<Func<TEntity, object>>[] propertySelectors)
Parameters
Type |
Name |
Description |
Expression<Func<TEntity, System.Object>>[] |
propertySelectors |
|
Returns
Type |
Description |
IQueryable<TEntity> |
|
Explicit Interface Implementations
IEfCoreRepository<TEntity>.DbContext
Declaration
DbContext IEfCoreRepository<TEntity>.DbContext { get; }
Returns
Type |
Description |
DbContext |
|
Implements
IServiceProviderAccessor
ITransientDependency
IQueryable<>
IAsyncEnumerable<>
Extension Methods