Class MongoDbRepository<TMongoDbContext, TEntity>
Inheritance
object
MongoDbRepository<TMongoDbContext, 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.MongoDB.dll
Syntax
public class MongoDbRepository<TMongoDbContext, TEntity> : RepositoryBase<TEntity>, IServiceProviderAccessor, IUnitOfWorkEnabled, IUnitOfWorkManagerAccessor, IMongoDbRepository<TEntity>, IRepository<TEntity>, IReadOnlyRepository<TEntity>, IBasicRepository<TEntity>, IReadOnlyBasicRepository<TEntity>, IRepository where TMongoDbContext : IAbpMongoDbContext where TEntity : class, IEntity
Type Parameters
| Name |
Description |
| TMongoDbContext |
|
| TEntity |
|
Constructors
MongoDbRepository(IMongoDbContextProvider<TMongoDbContext>)
Declaration
public MongoDbRepository(IMongoDbContextProvider<TMongoDbContext> dbContextProvider)
Parameters
Properties
AuditPropertySetter
Declaration
public IAuditPropertySetter AuditPropertySetter { get; }
Property Value
BulkOperationProvider
Declaration
public IMongoDbBulkOperationProvider BulkOperationProvider { get; }
Property Value
Collection
Declaration
[Obsolete("Use GetCollectionAsync method.")]
public virtual IMongoCollection<TEntity> Collection { get; }
Property Value
| Type |
Description |
| MongoDB.Driver.IMongoCollection<><TEntity> |
|
Database
Declaration
[Obsolete("Use GetDatabaseAsync method.")]
public virtual IMongoDatabase Database { get; }
Property Value
| Type |
Description |
| MongoDB.Driver.IMongoDatabase |
|
DbContext
Declaration
[Obsolete("Use GetDbContextAsync method.")]
protected virtual TMongoDbContext DbContext { get; }
Property Value
| Type |
Description |
| TMongoDbContext |
|
DbContextProvider
Declaration
protected IMongoDbContextProvider<TMongoDbContext> DbContextProvider { get; }
Property Value
DistributedEventBus
Declaration
public IDistributedEventBus DistributedEventBus { get; }
Property Value
EntityChangeEventHelper
Declaration
public IEntityChangeEventHelper EntityChangeEventHelper { get; }
Property Value
GuidGenerator
Declaration
public IGuidGenerator GuidGenerator { get; }
Property Value
LocalEventBus
Declaration
public ILocalEventBus LocalEventBus { get; }
Property Value
SessionHandle
Declaration
[Obsolete("Use GetSessionHandleAsync method.")]
protected virtual IClientSessionHandle SessionHandle { get; }
Property Value
| Type |
Description |
| MongoDB.Driver.IClientSessionHandle |
|
Methods
ApplyAbpConceptsForAddedEntityAsync(TEntity)
Declaration
protected virtual Task ApplyAbpConceptsForAddedEntityAsync(TEntity entity)
Parameters
| Type |
Name |
Description |
| TEntity |
entity |
|
Returns
| Type |
Description |
| System.Threading.Tasks.Task |
|
ApplyAbpConceptsForDeletedEntity(TEntity)
Declaration
protected virtual void ApplyAbpConceptsForDeletedEntity(TEntity entity)
Parameters
| Type |
Name |
Description |
| TEntity |
entity |
|
CheckAndSetId(TEntity)
Declaration
protected virtual void CheckAndSetId(TEntity entity)
Parameters
| Type |
Name |
Description |
| TEntity |
entity |
|
CreateEntitiesFilterAsync(IEnumerable<TEntity>, bool)
Declaration
protected virtual Task<FilterDefinition<TEntity>> CreateEntitiesFilterAsync(IEnumerable<TEntity> entities, bool withConcurrencyStamp = false)
Parameters
| Type |
Name |
Description |
| System.Collections.Generic.IEnumerable<T><TEntity> |
entities |
|
| bool |
withConcurrencyStamp |
|
Returns
| Type |
Description |
| System.Threading.Tasks.Task<TResult><FilterDefinition<TEntity>> |
|
CreateEntityFilterAsync(TEntity, bool, string)
Declaration
protected virtual Task<FilterDefinition<TEntity>> CreateEntityFilterAsync(TEntity entity, bool withConcurrencyStamp = false, string concurrencyStamp = null)
Parameters
| Type |
Name |
Description |
| TEntity |
entity |
|
| bool |
withConcurrencyStamp |
|
| string |
concurrencyStamp |
|
Returns
| Type |
Description |
| System.Threading.Tasks.Task<TResult><FilterDefinition<TEntity>> |
|
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)
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)
GetAggregateAsync(CancellationToken, AggregateOptions)
Declaration
public virtual Task<IAggregateFluent<TEntity>> GetAggregateAsync(CancellationToken cancellationToken = default, AggregateOptions aggregateOptions = null)
Parameters
| Type |
Name |
Description |
| System.Threading.CancellationToken |
cancellationToken |
|
| MongoDB.Driver.AggregateOptions |
aggregateOptions |
|
Returns
| Type |
Description |
| System.Threading.Tasks.Task<TResult><IAggregateFluent<TEntity>> |
|
GetCollectionAsync(CancellationToken)
Declaration
public Task<IMongoCollection<TEntity>> GetCollectionAsync(CancellationToken cancellationToken = default)
Parameters
| Type |
Name |
Description |
| System.Threading.CancellationToken |
cancellationToken |
|
Returns
| Type |
Description |
| System.Threading.Tasks.Task<TResult><MongoDB.Driver.IMongoCollection<><TEntity>> |
|
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)
GetDatabaseAsync(CancellationToken)
Declaration
public Task<IMongoDatabase> GetDatabaseAsync(CancellationToken cancellationToken = default)
Parameters
| Type |
Name |
Description |
| System.Threading.CancellationToken |
cancellationToken |
|
Returns
| Type |
Description |
| System.Threading.Tasks.Task<TResult><MongoDB.Driver.IMongoDatabase> |
|
GetDbContextAsync(CancellationToken)
Declaration
protected Task<TMongoDbContext> GetDbContextAsync(CancellationToken cancellationToken = default)
Parameters
| Type |
Name |
Description |
| System.Threading.CancellationToken |
cancellationToken |
|
Returns
| Type |
Description |
| System.Threading.Tasks.Task<TResult><TMongoDbContext> |
|
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)
GetMongoQueryable()
Declaration
[Obsolete("Use GetMongoQueryableAsync method.")]
public virtual IMongoQueryable<TEntity> GetMongoQueryable()
Returns
| Type |
Description |
| MongoDB.Driver.Linq.IMongoQueryable<><TEntity> |
|
GetMongoQueryableAsync(CancellationToken, AggregateOptions)
Declaration
public virtual Task<IMongoQueryable<TEntity>> GetMongoQueryableAsync(CancellationToken cancellationToken = default, AggregateOptions aggregateOptions = null)
Parameters
| Type |
Name |
Description |
| System.Threading.CancellationToken |
cancellationToken |
|
| MongoDB.Driver.AggregateOptions |
aggregateOptions |
|
Returns
| Type |
Description |
| System.Threading.Tasks.Task<TResult><MongoDB.Driver.Linq.IMongoQueryable<><TEntity>> |
|
GetMongoQueryableAsync<TOtherEntity>(CancellationToken, AggregateOptions)
Declaration
protected virtual Task<IMongoQueryable<TOtherEntity>> GetMongoQueryableAsync<TOtherEntity>(CancellationToken cancellationToken = default, AggregateOptions aggregateOptions = null)
Parameters
| Type |
Name |
Description |
| System.Threading.CancellationToken |
cancellationToken |
|
| MongoDB.Driver.AggregateOptions |
aggregateOptions |
|
Returns
| Type |
Description |
| System.Threading.Tasks.Task<TResult><MongoDB.Driver.Linq.IMongoQueryable<><TOtherEntity>> |
|
Type Parameters
| Name |
Description |
| TOtherEntity |
|
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()
GetSessionHandleAsync(CancellationToken)
Declaration
protected Task<IClientSessionHandle> GetSessionHandleAsync(CancellationToken cancellationToken = default)
Parameters
| Type |
Name |
Description |
| System.Threading.CancellationToken |
cancellationToken |
|
Returns
| Type |
Description |
| System.Threading.Tasks.Task<TResult><MongoDB.Driver.IClientSessionHandle> |
|
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)
IsHardDeleted(TEntity)
Declaration
protected virtual bool IsHardDeleted(TEntity entity)
Parameters
| Type |
Name |
Description |
| TEntity |
entity |
|
Returns
SetCreationAuditProperties(TEntity)
Declaration
protected virtual void SetCreationAuditProperties(TEntity entity)
Parameters
| Type |
Name |
Description |
| TEntity |
entity |
|
SetDeletionAuditProperties(TEntity)
Declaration
protected virtual void SetDeletionAuditProperties(TEntity entity)
Parameters
| Type |
Name |
Description |
| TEntity |
entity |
|
SetModificationAuditProperties(TEntity)
Declaration
protected virtual void SetModificationAuditProperties(TEntity entity)
Parameters
| Type |
Name |
Description |
| TEntity |
entity |
|
SetNewConcurrencyStamp(TEntity)
Declaration
protected virtual string SetNewConcurrencyStamp(TEntity entity)
Parameters
| Type |
Name |
Description |
| TEntity |
entity |
|
Returns
ThrowOptimisticConcurrencyException()
Declaration
protected virtual void ThrowOptimisticConcurrencyException()
TriggerDomainEvents(object)
Declaration
protected virtual void TriggerDomainEvents(object entity)
Parameters
| Type |
Name |
Description |
| object |
entity |
|
TriggerEntityDeleteEvents(TEntity)
Declaration
protected virtual void TriggerEntityDeleteEvents(TEntity entity)
Parameters
| Type |
Name |
Description |
| TEntity |
entity |
|
TriggerEntityUpdateEvents(TEntity)
Declaration
protected virtual void TriggerEntityUpdateEvents(TEntity entity)
Parameters
| Type |
Name |
Description |
| TEntity |
entity |
|
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)
Implements
Extension Methods