virtualized

pull/3174/head
Ahmet Çotur 5 years ago
parent 819aebe16e
commit 8567def710

@ -14,10 +14,10 @@ namespace Volo.Abp.AuditLogging
{
public ILogger<AuditingStore> 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<AbpAuditingOptions> options)
{
_auditLogRepository = auditLogRepository;
_guidGenerator = guidGenerator;
_unitOfWorkManager = unitOfWorkManager;
AuditLogRepository = auditLogRepository;
GuidGenerator = guidGenerator;
UnitOfWorkManager = unitOfWorkManager;
Options = options.Value;
Logger = NullLogger<AuditingStore>.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();
}
}

@ -19,7 +19,7 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore
}
public async Task<List<AuditLog>> GetListAsync(
public virtual async Task<List<AuditLog>> GetListAsync(
string sorting = null,
int maxResultCount = 50,
int skipCount = 0,
@ -59,7 +59,7 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore
return auditLogs;
}
public async Task<long> GetCountAsync(
public virtual async Task<long> GetCountAsync(
DateTime? startTime = null,
DateTime? endTime = null,
string httpMethod = null,
@ -92,7 +92,7 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore
return totalCount;
}
private IQueryable<AuditLog> GetListQuery(
protected virtual IQueryable<AuditLog> 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<Dictionary<DateTime, double>> GetAverageExecutionDurationPerDayAsync(DateTime startDate, DateTime endDate)
public virtual async Task<Dictionary<DateTime, double>> GetAverageExecutionDurationPerDayAsync(DateTime startDate, DateTime endDate)
{
var result = await DbSet.AsNoTracking()
.Where(a => a.ExecutionTime < endDate.AddDays(1) && a.ExecutionTime > startDate)

@ -20,7 +20,7 @@ namespace Volo.Abp.AuditLogging.MongoDB
}
public async Task<List<AuditLog>> GetListAsync(
public virtual async Task<List<AuditLog>> 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<long> GetCountAsync(
public virtual async Task<long> GetCountAsync(
DateTime? startTime = null,
DateTime? endTime = null,
string httpMethod = null,
@ -92,7 +92,7 @@ namespace Volo.Abp.AuditLogging.MongoDB
return count;
}
private IQueryable<AuditLog> GetListQuery(
protected virtual IQueryable<AuditLog> GetListQuery(
DateTime? startTime = null,
DateTime? endTime = null,
string httpMethod = null,
@ -122,7 +122,7 @@ namespace Volo.Abp.AuditLogging.MongoDB
}
public async Task<Dictionary<DateTime, double>> GetAverageExecutionDurationPerDayAsync(DateTime startDate, DateTime endDate)
public virtual async Task<Dictionary<DateTime, double>> GetAverageExecutionDurationPerDayAsync(DateTime startDate, DateTime endDate)
{
var result = await GetMongoQueryable()
.Where(a => a.ExecutionTime < endDate.AddDays(1) && a.ExecutionTime > startDate)

Loading…
Cancel
Save