|
|
|
@ -37,29 +37,24 @@ namespace Volo.Abp.Domain.Repositories.MongoDB |
|
|
|
|
|
|
|
protected IMongoDbContextProvider<TMongoDbContext> DbContextProvider { get; } |
|
|
|
|
|
|
|
public ILocalEventBus LocalEventBus { get; set; } |
|
|
|
public ILocalEventBus LocalEventBus => LazyServiceProvider.LazyGetService<ILocalEventBus>(NullLocalEventBus.Instance); |
|
|
|
|
|
|
|
public IDistributedEventBus DistributedEventBus { get; set; } |
|
|
|
public IDistributedEventBus DistributedEventBus => LazyServiceProvider.LazyGetService<IDistributedEventBus>(NullDistributedEventBus.Instance); |
|
|
|
|
|
|
|
public IEntityChangeEventHelper EntityChangeEventHelper { get; set; } |
|
|
|
public IEntityChangeEventHelper EntityChangeEventHelper => LazyServiceProvider.LazyGetService<IEntityChangeEventHelper>(NullEntityChangeEventHelper.Instance); |
|
|
|
|
|
|
|
public IGuidGenerator GuidGenerator { get; set; } |
|
|
|
public IGuidGenerator GuidGenerator => LazyServiceProvider.LazyGetService<IGuidGenerator>(SimpleGuidGenerator.Instance); |
|
|
|
|
|
|
|
public IAuditPropertySetter AuditPropertySetter { get; set; } |
|
|
|
public IAuditPropertySetter AuditPropertySetter => LazyServiceProvider.LazyGetRequiredService<IAuditPropertySetter>(); |
|
|
|
|
|
|
|
public IMongoDbBulkOperationProvider BulkOperationProvider { get; set; } |
|
|
|
public IMongoDbBulkOperationProvider BulkOperationProvider => LazyServiceProvider.LazyGetService<IMongoDbBulkOperationProvider>(); |
|
|
|
|
|
|
|
public MongoDbRepository(IMongoDbContextProvider<TMongoDbContext> dbContextProvider) |
|
|
|
{ |
|
|
|
DbContextProvider = dbContextProvider; |
|
|
|
|
|
|
|
LocalEventBus = NullLocalEventBus.Instance; |
|
|
|
DistributedEventBus = NullDistributedEventBus.Instance; |
|
|
|
EntityChangeEventHelper = NullEntityChangeEventHelper.Instance; |
|
|
|
GuidGenerator = SimpleGuidGenerator.Instance; |
|
|
|
} |
|
|
|
|
|
|
|
public async override Task<TEntity> InsertAsync( |
|
|
|
public override async Task<TEntity> InsertAsync( |
|
|
|
TEntity entity, |
|
|
|
bool autoSave = false, |
|
|
|
CancellationToken cancellationToken = default) |
|
|
|
@ -113,7 +108,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public async override Task<TEntity> UpdateAsync( |
|
|
|
public override async Task<TEntity> UpdateAsync( |
|
|
|
TEntity entity, |
|
|
|
bool autoSave = false, |
|
|
|
CancellationToken cancellationToken = default) |
|
|
|
@ -216,7 +211,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public async override Task DeleteAsync( |
|
|
|
public override async Task DeleteAsync( |
|
|
|
TEntity entity, |
|
|
|
bool autoSave = false, |
|
|
|
CancellationToken cancellationToken = default) |
|
|
|
@ -346,17 +341,17 @@ namespace Volo.Abp.Domain.Repositories.MongoDB |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public async override Task<List<TEntity>> GetListAsync(bool includeDetails = false, CancellationToken cancellationToken = default) |
|
|
|
public override async Task<List<TEntity>> GetListAsync(bool includeDetails = false, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
return await GetMongoQueryable().ToListAsync(GetCancellationToken(cancellationToken)); |
|
|
|
} |
|
|
|
|
|
|
|
public async override Task<long> GetCountAsync(CancellationToken cancellationToken = default) |
|
|
|
public override async Task<long> GetCountAsync(CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
return await GetMongoQueryable().LongCountAsync(GetCancellationToken(cancellationToken)); |
|
|
|
} |
|
|
|
|
|
|
|
public async override Task<List<TEntity>> GetPagedListAsync( |
|
|
|
public override async Task<List<TEntity>> GetPagedListAsync( |
|
|
|
int skipCount, |
|
|
|
int maxResultCount, |
|
|
|
string sorting, |
|
|
|
@ -370,7 +365,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB |
|
|
|
.ToListAsync(GetCancellationToken(cancellationToken)); |
|
|
|
} |
|
|
|
|
|
|
|
public async override Task DeleteAsync( |
|
|
|
public override async Task DeleteAsync( |
|
|
|
Expression<Func<TEntity, bool>> predicate, |
|
|
|
bool autoSave = false, |
|
|
|
CancellationToken cancellationToken = default) |
|
|
|
@ -390,7 +385,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB |
|
|
|
return GetMongoQueryable(); |
|
|
|
} |
|
|
|
|
|
|
|
public async override Task<TEntity> FindAsync( |
|
|
|
public override async Task<TEntity> FindAsync( |
|
|
|
Expression<Func<TEntity, bool>> predicate, |
|
|
|
bool includeDetails = true, |
|
|
|
CancellationToken cancellationToken = default) |
|
|
|
|