From 8567def71080033e18a2fa89a4ce1525745c8d87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20=C3=87otur?= Date: Wed, 18 Mar 2020 11:14:53 +0300 Subject: [PATCH] virtualized --- .../Volo/Abp/AuditLogging/AuditingStore.cs | 20 +++++++++---------- .../EfCoreAuditLogRepository.cs | 8 ++++---- .../MongoDB/MongoAuditLogRepository.cs | 8 ++++---- 3 files changed, 18 insertions(+), 18 deletions(-) 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 8aaed79d5f..faaf01120e 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 @@ namespace Volo.Abp.AuditLogging { 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 @@ namespace Volo.Abp.AuditLogging 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 @@ namespace Volo.Abp.AuditLogging 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 1a13b702b0..1fabbcbe7c 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 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore } - public async Task> GetListAsync( + public virtual async Task> GetListAsync( string sorting = null, int maxResultCount = 50, int skipCount = 0, @@ -59,7 +59,7 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore return auditLogs; } - public async Task GetCountAsync( + public virtual async Task GetCountAsync( DateTime? startTime = null, DateTime? endTime = null, string httpMethod = null, @@ -92,7 +92,7 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore return totalCount; } - private IQueryable GetListQuery( + protected virtual IQueryable GetListQuery( DateTime? startTime = null, DateTime? endTime = null, string httpMethod = null, @@ -123,7 +123,7 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore .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 8beeff86a3..fdb9bca387 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 @@ namespace Volo.Abp.AuditLogging.MongoDB } - public async Task> GetListAsync( + public virtual async Task> GetListAsync( string sorting = null, int maxResultCount = 50, int skipCount = 0, @@ -58,7 +58,7 @@ namespace Volo.Abp.AuditLogging.MongoDB .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 @@ namespace Volo.Abp.AuditLogging.MongoDB return count; } - private IQueryable GetListQuery( + protected virtual IQueryable GetListQuery( DateTime? startTime = null, DateTime? endTime = null, string httpMethod = null, @@ -122,7 +122,7 @@ namespace Volo.Abp.AuditLogging.MongoDB } - 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)