diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditingStore.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditingStore.cs index 8aaed79d5fd..faaf01120e7 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditingStore.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditingStore.cs @@ -14,10 +14,10 @@ public class AuditingStore : IAuditingStore, ITransientDependency { public ILogger Logger { get; set; } - private readonly IAuditLogRepository _auditLogRepository; - private readonly IGuidGenerator _guidGenerator; - private readonly IUnitOfWorkManager _unitOfWorkManager; - private readonly AbpAuditingOptions Options; + protected IAuditLogRepository AuditLogRepository { get; } + protected IGuidGenerator GuidGenerator { get; } + protected IUnitOfWorkManager UnitOfWorkManager { get; } + protected AbpAuditingOptions Options { get; } public AuditingStore( IAuditLogRepository auditLogRepository, @@ -25,15 +25,15 @@ public AuditingStore( IUnitOfWorkManager unitOfWorkManager, IOptions options) { - _auditLogRepository = auditLogRepository; - _guidGenerator = guidGenerator; - _unitOfWorkManager = unitOfWorkManager; + AuditLogRepository = auditLogRepository; + GuidGenerator = guidGenerator; + UnitOfWorkManager = unitOfWorkManager; Options = options.Value; Logger = NullLogger.Instance; } - public async Task SaveAsync(AuditLogInfo auditInfo) + public virtual async Task SaveAsync(AuditLogInfo auditInfo) { if (!Options.HideErrors) { @@ -54,9 +54,9 @@ public async Task SaveAsync(AuditLogInfo auditInfo) protected virtual async Task SaveLogAsync(AuditLogInfo auditInfo) { - using (var uow = _unitOfWorkManager.Begin(true)) + using (var uow = UnitOfWorkManager.Begin(true)) { - await _auditLogRepository.InsertAsync(new AuditLog(_guidGenerator, auditInfo)); + await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, auditInfo)); await uow.SaveChangesAsync(); } } diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs index 1a13b702b07..1fabbcbe7c1 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs @@ -19,7 +19,7 @@ public EfCoreAuditLogRepository(IDbContextProvider dbCon } - public async Task> GetListAsync( + public virtual async Task> GetListAsync( string sorting = null, int maxResultCount = 50, int skipCount = 0, @@ -59,7 +59,7 @@ public async Task> GetListAsync( return auditLogs; } - public async Task GetCountAsync( + public virtual async Task GetCountAsync( DateTime? startTime = null, DateTime? endTime = null, string httpMethod = null, @@ -92,7 +92,7 @@ public async Task GetCountAsync( return totalCount; } - private IQueryable GetListQuery( + protected virtual IQueryable GetListQuery( DateTime? startTime = null, DateTime? endTime = null, string httpMethod = null, @@ -123,7 +123,7 @@ private IQueryable GetListQuery( .WhereIf(minExecutionDuration != null && minExecutionDuration.Value > 0, auditLog => auditLog.ExecutionDuration >= minExecutionDuration); } - public async Task> GetAverageExecutionDurationPerDayAsync(DateTime startDate, DateTime endDate) + public virtual async Task> GetAverageExecutionDurationPerDayAsync(DateTime startDate, DateTime endDate) { var result = await DbSet.AsNoTracking() .Where(a => a.ExecutionTime < endDate.AddDays(1) && a.ExecutionTime > startDate) diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs index 8beeff86a36..fdb9bca3879 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs @@ -20,7 +20,7 @@ public MongoAuditLogRepository(IMongoDbContextProvider> GetListAsync( + public virtual async Task> GetListAsync( string sorting = null, int maxResultCount = 50, int skipCount = 0, @@ -58,7 +58,7 @@ public async Task> GetListAsync( .ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task GetCountAsync( + public virtual async Task GetCountAsync( DateTime? startTime = null, DateTime? endTime = null, string httpMethod = null, @@ -92,7 +92,7 @@ public async Task GetCountAsync( return count; } - private IQueryable GetListQuery( + protected virtual IQueryable GetListQuery( DateTime? startTime = null, DateTime? endTime = null, string httpMethod = null, @@ -122,7 +122,7 @@ private IQueryable GetListQuery( } - public async Task> GetAverageExecutionDurationPerDayAsync(DateTime startDate, DateTime endDate) + public virtual async Task> GetAverageExecutionDurationPerDayAsync(DateTime startDate, DateTime endDate) { var result = await GetMongoQueryable() .Where(a => a.ExecutionTime < endDate.AddDays(1) && a.ExecutionTime > startDate)