Use RemoteServiceErrorInfo as the exception info in the AuditLog.

Resolve #9101
pull/9116/head
maliming 4 years ago
parent 9ebb57adee
commit 2491c8c488

@ -26,8 +26,7 @@ namespace Volo.Abp.EntityFrameworkCore.EntityHistory
protected IJsonSerializer JsonSerializer { get; } protected IJsonSerializer JsonSerializer { get; }
protected AbpAuditingOptions Options { get; } protected AbpAuditingOptions Options { get; }
protected IAuditingHelper AuditingHelper { get; } protected IAuditingHelper AuditingHelper { get; }
protected IClock Clock{ get; }
private readonly IClock _clock;
public EntityHistoryHelper( public EntityHistoryHelper(
IAuditingStore auditingStore, IAuditingStore auditingStore,
@ -36,7 +35,7 @@ namespace Volo.Abp.EntityFrameworkCore.EntityHistory
IJsonSerializer jsonSerializer, IJsonSerializer jsonSerializer,
IAuditingHelper auditingHelper) IAuditingHelper auditingHelper)
{ {
_clock = clock; Clock = clock;
AuditingStore = auditingStore; AuditingStore = auditingStore;
JsonSerializer = jsonSerializer; JsonSerializer = jsonSerializer;
AuditingHelper = auditingHelper; AuditingHelper = auditingHelper;
@ -69,7 +68,7 @@ namespace Volo.Abp.EntityFrameworkCore.EntityHistory
} }
[CanBeNull] [CanBeNull]
private EntityChangeInfo CreateEntityChangeOrNull(EntityEntry entityEntry) protected virtual EntityChangeInfo CreateEntityChangeOrNull(EntityEntry entityEntry)
{ {
var entity = entityEntry.Entity; var entity = entityEntry.Entity;
@ -121,23 +120,23 @@ namespace Volo.Abp.EntityFrameworkCore.EntityHistory
return multiTenantEntity.TenantId; return multiTenantEntity.TenantId;
} }
private DateTime GetChangeTime(EntityChangeInfo entityChange) protected virtual DateTime GetChangeTime(EntityChangeInfo entityChange)
{ {
var entity = entityChange.EntityEntry.As<EntityEntry>().Entity; var entity = entityChange.EntityEntry.As<EntityEntry>().Entity;
switch (entityChange.ChangeType) switch (entityChange.ChangeType)
{ {
case EntityChangeType.Created: case EntityChangeType.Created:
return (entity as IHasCreationTime)?.CreationTime ?? _clock.Now; return (entity as IHasCreationTime)?.CreationTime ?? Clock.Now;
case EntityChangeType.Deleted: case EntityChangeType.Deleted:
return (entity as IHasDeletionTime)?.DeletionTime ?? _clock.Now; return (entity as IHasDeletionTime)?.DeletionTime ?? Clock.Now;
case EntityChangeType.Updated: case EntityChangeType.Updated:
return (entity as IHasModificationTime)?.LastModificationTime ?? _clock.Now; return (entity as IHasModificationTime)?.LastModificationTime ?? Clock.Now;
default: default:
throw new AbpException($"Unknown {nameof(EntityChangeInfo)}: {entityChange}"); throw new AbpException($"Unknown {nameof(EntityChangeInfo)}: {entityChange}");
} }
} }
private string GetEntityId(object entityAsObj) protected virtual string GetEntityId(object entityAsObj)
{ {
if (!(entityAsObj is IEntity entity)) if (!(entityAsObj is IEntity entity))
{ {
@ -156,7 +155,7 @@ namespace Volo.Abp.EntityFrameworkCore.EntityHistory
/// <summary> /// <summary>
/// Gets the property changes for this entry. /// Gets the property changes for this entry.
/// </summary> /// </summary>
private List<EntityPropertyChangeInfo> GetPropertyChanges(EntityEntry entityEntry) protected virtual List<EntityPropertyChangeInfo> GetPropertyChanges(EntityEntry entityEntry)
{ {
var propertyChanges = new List<EntityPropertyChangeInfo>(); var propertyChanges = new List<EntityPropertyChangeInfo>();
var properties = entityEntry.Metadata.GetProperties(); var properties = entityEntry.Metadata.GetProperties();
@ -181,12 +180,12 @@ namespace Volo.Abp.EntityFrameworkCore.EntityHistory
return propertyChanges; return propertyChanges;
} }
private bool IsCreated(EntityEntry entityEntry) protected virtual bool IsCreated(EntityEntry entityEntry)
{ {
return entityEntry.State == EntityState.Added; return entityEntry.State == EntityState.Added;
} }
private bool IsDeleted(EntityEntry entityEntry) protected virtual bool IsDeleted(EntityEntry entityEntry)
{ {
if (entityEntry.State == EntityState.Deleted) if (entityEntry.State == EntityState.Deleted)
{ {
@ -197,7 +196,7 @@ namespace Volo.Abp.EntityFrameworkCore.EntityHistory
return entity is ISoftDelete && entity.As<ISoftDelete>().IsDeleted; return entity is ISoftDelete && entity.As<ISoftDelete>().IsDeleted;
} }
private bool ShouldSaveEntityHistory(EntityEntry entityEntry, bool defaultValue = false) protected virtual bool ShouldSaveEntityHistory(EntityEntry entityEntry, bool defaultValue = false)
{ {
if (entityEntry.State == EntityState.Detached || if (entityEntry.State == EntityState.Detached ||
entityEntry.State == EntityState.Unchanged) entityEntry.State == EntityState.Unchanged)
@ -220,7 +219,7 @@ namespace Volo.Abp.EntityFrameworkCore.EntityHistory
return defaultValue; return defaultValue;
} }
private bool ShouldSavePropertyHistory(PropertyEntry propertyEntry, bool defaultValue) protected virtual bool ShouldSavePropertyHistory(PropertyEntry propertyEntry, bool defaultValue)
{ {
if (propertyEntry.Metadata.Name == "Id") if (propertyEntry.Metadata.Name == "Id")
{ {
@ -256,7 +255,7 @@ namespace Volo.Abp.EntityFrameworkCore.EntityHistory
return defaultValue; return defaultValue;
} }
private bool IsBaseAuditProperty(PropertyInfo propertyInfo, Type entityType) protected virtual bool IsBaseAuditProperty(PropertyInfo propertyInfo, Type entityType)
{ {
if (entityType.IsAssignableTo<IHasCreationTime>() if (entityType.IsAssignableTo<IHasCreationTime>()
&& propertyInfo.Name == nameof(IHasCreationTime.CreationTime)) && propertyInfo.Name == nameof(IHasCreationTime.CreationTime))
@ -312,7 +311,7 @@ namespace Volo.Abp.EntityFrameworkCore.EntityHistory
/// <summary> /// <summary>
/// Updates change time, entity id and foreign keys after SaveChanges is called. /// Updates change time, entity id and foreign keys after SaveChanges is called.
/// </summary> /// </summary>
public void UpdateChangeList(List<EntityChangeInfo> entityChanges) public virtual void UpdateChangeList(List<EntityChangeInfo> entityChanges)
{ {
foreach (var entityChange in entityChanges) foreach (var entityChange in entityChanges)
{ {

@ -1,5 +1,7 @@
using Volo.Abp.Auditing; using Volo.Abp.Auditing;
using Volo.Abp.Domain; using Volo.Abp.Domain;
using Volo.Abp.ExceptionHandling;
using Volo.Abp.Json;
using Volo.Abp.Modularity; using Volo.Abp.Modularity;
using Volo.Abp.ObjectExtending; using Volo.Abp.ObjectExtending;
using Volo.Abp.ObjectExtending.Modularity; using Volo.Abp.ObjectExtending.Modularity;
@ -10,6 +12,8 @@ namespace Volo.Abp.AuditLogging
[DependsOn(typeof(AbpAuditingModule))] [DependsOn(typeof(AbpAuditingModule))]
[DependsOn(typeof(AbpDddDomainModule))] [DependsOn(typeof(AbpDddDomainModule))]
[DependsOn(typeof(AbpAuditLoggingDomainSharedModule))] [DependsOn(typeof(AbpAuditLoggingDomainSharedModule))]
[DependsOn(typeof(AbpExceptionHandlingModule))]
[DependsOn(typeof(AbpJsonModule))]
public class AbpAuditLoggingDomainModule : AbpModule public class AbpAuditLoggingDomainModule : AbpModule
{ {
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner();

@ -59,57 +59,55 @@ namespace Volo.Abp.AuditLogging
} }
public AuditLog(IGuidGenerator guidGenerator, AuditLogInfo auditInfo) public AuditLog(
: base(guidGenerator.Create()) Guid id,
string applicationName,
Guid? tenantId,
string tenantName,
Guid? userId,
string userName,
DateTime executionTime,
int executionDuration,
string clientIpAddress,
string clientName,
string clientId,
string correlationId,
string browserInfo,
string httpMethod,
string url,
int? httpStatusCode,
Guid? impersonatorUserId,
Guid? impersonatorTenantId,
ExtraPropertyDictionary extraPropertyDictionary,
List<EntityChange> entityChanges,
List<AuditLogAction> actions,
string exceptions,
string comments)
: base(id)
{ {
ApplicationName = auditInfo.ApplicationName.Truncate(AuditLogConsts.MaxApplicationNameLength); ApplicationName = applicationName.Truncate(AuditLogConsts.MaxApplicationNameLength);
TenantId = auditInfo.TenantId; TenantId = tenantId;
TenantName = auditInfo.TenantName.Truncate(AuditLogConsts.MaxTenantNameLength); TenantName = tenantName.Truncate(AuditLogConsts.MaxTenantNameLength);
UserId = auditInfo.UserId; UserId = userId;
UserName = auditInfo.UserName.Truncate(AuditLogConsts.MaxUserNameLength); UserName = userName.Truncate(AuditLogConsts.MaxUserNameLength);
ExecutionTime = auditInfo.ExecutionTime; ExecutionTime = executionTime;
ExecutionDuration = auditInfo.ExecutionDuration; ExecutionDuration = executionDuration;
ClientIpAddress = auditInfo.ClientIpAddress.Truncate(AuditLogConsts.MaxClientIpAddressLength); ClientIpAddress = clientIpAddress.Truncate(AuditLogConsts.MaxClientIpAddressLength);
ClientName = auditInfo.ClientName.Truncate(AuditLogConsts.MaxClientNameLength); ClientName = clientName.Truncate(AuditLogConsts.MaxClientNameLength);
ClientId = auditInfo.ClientId.Truncate(AuditLogConsts.MaxClientIdLength); ClientId = clientId.Truncate(AuditLogConsts.MaxClientIdLength);
CorrelationId = auditInfo.CorrelationId.Truncate(AuditLogConsts.MaxCorrelationIdLength); CorrelationId = correlationId.Truncate(AuditLogConsts.MaxCorrelationIdLength);
BrowserInfo = auditInfo.BrowserInfo.Truncate(AuditLogConsts.MaxBrowserInfoLength); BrowserInfo = browserInfo.Truncate(AuditLogConsts.MaxBrowserInfoLength);
HttpMethod = auditInfo.HttpMethod.Truncate(AuditLogConsts.MaxHttpMethodLength); HttpMethod = httpMethod.Truncate(AuditLogConsts.MaxHttpMethodLength);
Url = auditInfo.Url.Truncate(AuditLogConsts.MaxUrlLength); Url = url.Truncate(AuditLogConsts.MaxUrlLength);
HttpStatusCode = auditInfo.HttpStatusCode; HttpStatusCode = httpStatusCode;
ImpersonatorUserId = auditInfo.ImpersonatorUserId; ImpersonatorUserId = impersonatorUserId;
ImpersonatorTenantId = auditInfo.ImpersonatorTenantId; ImpersonatorTenantId = impersonatorTenantId;
ExtraProperties = new ExtraPropertyDictionary(); ExtraProperties = extraPropertyDictionary;
if (auditInfo.ExtraProperties != null) EntityChanges = entityChanges;
{ Actions = actions;
foreach (var pair in auditInfo.ExtraProperties) Exceptions = exceptions.Truncate(AuditLogConsts.MaxExceptionsLengthValue);
{ Comments = comments.Truncate(AuditLogConsts.MaxCommentsLength);
ExtraProperties.Add(pair.Key, pair.Value);
}
}
EntityChanges = auditInfo
.EntityChanges?
.Select(entityChangeInfo => new EntityChange(guidGenerator, Id, entityChangeInfo, tenantId: auditInfo.TenantId))
.ToList()
?? new List<EntityChange>();
Actions = auditInfo
.Actions?
.Select(auditLogActionInfo => new AuditLogAction(guidGenerator.Create(), Id, auditLogActionInfo, tenantId: auditInfo.TenantId))
.ToList()
?? new List<AuditLogAction>();
Exceptions = auditInfo
.Exceptions?
.JoinAsString(Environment.NewLine)
.Truncate(AuditLogConsts.MaxExceptionsLengthValue);
Comments = auditInfo
.Comments?
.JoinAsString(Environment.NewLine)
.Truncate(AuditLogConsts.MaxCommentsLength);
} }
} }
} }

@ -0,0 +1,93 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.AspNetCore.ExceptionHandling;
using Volo.Abp.Auditing;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Guids;
using Volo.Abp.Http;
using Volo.Abp.Json;
namespace Volo.Abp.AuditLogging
{
public class AuditLogInfoToAuditLogConverter : IAuditLogInfoToAuditLogConverter, ITransientDependency
{
protected IGuidGenerator GuidGenerator { get; }
protected IExceptionToErrorInfoConverter ExceptionToErrorInfoConverter { get; }
protected IJsonSerializer JsonSerializer { get; }
public AuditLogInfoToAuditLogConverter(IGuidGenerator guidGenerator, IExceptionToErrorInfoConverter exceptionToErrorInfoConverter, IJsonSerializer jsonSerializer)
{
GuidGenerator = guidGenerator;
ExceptionToErrorInfoConverter = exceptionToErrorInfoConverter;
JsonSerializer = jsonSerializer;
}
public virtual Task<AuditLog> ConvertAsync(AuditLogInfo auditLogInfo)
{
var auditLogId = GuidGenerator.Create();
var extraProperties = new ExtraPropertyDictionary();
if (auditLogInfo.ExtraProperties != null)
{
foreach (var pair in auditLogInfo.ExtraProperties)
{
extraProperties.Add(pair.Key, pair.Value);
}
}
var entityChanges = auditLogInfo
.EntityChanges?
.Select(entityChangeInfo => new EntityChange(GuidGenerator, auditLogId, entityChangeInfo, tenantId: auditLogInfo.TenantId))
.ToList()
?? new List<EntityChange>();
var actions = auditLogInfo
.Actions?
.Select(auditLogActionInfo => new AuditLogAction(GuidGenerator.Create(), auditLogId, auditLogActionInfo, tenantId: auditLogInfo.TenantId))
.ToList()
?? new List<AuditLogAction>();
var remoteServiceErrorInfos = auditLogInfo.Exceptions?.Select(exception => ExceptionToErrorInfoConverter.Convert(exception, true))
?? new List<RemoteServiceErrorInfo>();
var exceptions = remoteServiceErrorInfos.Any()
? JsonSerializer.Serialize(remoteServiceErrorInfos, indented: false)
: null;
var comments = auditLogInfo
.Comments?
.JoinAsString(Environment.NewLine);
var auditLog = new AuditLog(
auditLogId,
auditLogInfo.ApplicationName,
auditLogInfo.TenantId,
auditLogInfo.TenantName,
auditLogInfo.UserId,
auditLogInfo.UserName,
auditLogInfo.ExecutionTime,
auditLogInfo.ExecutionDuration,
auditLogInfo.ClientIpAddress,
auditLogInfo.ClientName,
auditLogInfo.ClientId,
auditLogInfo.CorrelationId,
auditLogInfo.BrowserInfo,
auditLogInfo.HttpMethod,
auditLogInfo.Url,
auditLogInfo.HttpStatusCode,
auditLogInfo.ImpersonatorUserId,
auditLogInfo.ImpersonatorTenantId,
extraProperties,
entityChanges,
actions,
exceptions,
comments
);
return Task.FromResult(auditLog);
}
}
}

@ -5,7 +5,6 @@ using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Volo.Abp.Auditing; using Volo.Abp.Auditing;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.Guids;
using Volo.Abp.Uow; using Volo.Abp.Uow;
namespace Volo.Abp.AuditLogging namespace Volo.Abp.AuditLogging
@ -13,21 +12,19 @@ namespace Volo.Abp.AuditLogging
public class AuditingStore : IAuditingStore, ITransientDependency public class AuditingStore : IAuditingStore, ITransientDependency
{ {
public ILogger<AuditingStore> Logger { get; set; } public ILogger<AuditingStore> Logger { get; set; }
protected IAuditLogRepository AuditLogRepository { get; } protected IAuditLogRepository AuditLogRepository { get; }
protected IGuidGenerator GuidGenerator { get; }
protected IUnitOfWorkManager UnitOfWorkManager { get; } protected IUnitOfWorkManager UnitOfWorkManager { get; }
protected AbpAuditingOptions Options { get; } protected AbpAuditingOptions Options { get; }
protected IAuditLogInfoToAuditLogConverter Converter { get; }
public AuditingStore( public AuditingStore(
IAuditLogRepository auditLogRepository, IAuditLogRepository auditLogRepository,
IGuidGenerator guidGenerator,
IUnitOfWorkManager unitOfWorkManager, IUnitOfWorkManager unitOfWorkManager,
IOptions<AbpAuditingOptions> options) IOptions<AbpAuditingOptions> options,
IAuditLogInfoToAuditLogConverter converter)
{ {
AuditLogRepository = auditLogRepository; AuditLogRepository = auditLogRepository;
GuidGenerator = guidGenerator;
UnitOfWorkManager = unitOfWorkManager; UnitOfWorkManager = unitOfWorkManager;
Converter = converter;
Options = options.Value; Options = options.Value;
Logger = NullLogger<AuditingStore>.Instance; Logger = NullLogger<AuditingStore>.Instance;
@ -56,7 +53,7 @@ namespace Volo.Abp.AuditLogging
{ {
using (var uow = UnitOfWorkManager.Begin(true)) using (var uow = UnitOfWorkManager.Begin(true))
{ {
await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, auditInfo)); await AuditLogRepository.InsertAsync(await Converter.ConvertAsync(auditInfo));
await uow.CompleteAsync(); await uow.CompleteAsync();
} }
} }

@ -0,0 +1,10 @@
using System.Threading.Tasks;
using Volo.Abp.Auditing;
namespace Volo.Abp.AuditLogging
{
public interface IAuditLogInfoToAuditLogConverter
{
Task<AuditLog> ConvertAsync(AuditLogInfo auditLogInfo);
}
}

@ -1,13 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.VisualBasic;
using Shouldly; using Shouldly;
using Volo.Abp.Auditing; using Volo.Abp.Auditing;
using Volo.Abp.Guids;
using Volo.Abp.Modularity; using Volo.Abp.Modularity;
using Xunit; using Xunit;
@ -17,12 +14,12 @@ namespace Volo.Abp.AuditLogging
where TStartupModule : IAbpModule where TStartupModule : IAbpModule
{ {
protected IAuditLogRepository AuditLogRepository { get; } protected IAuditLogRepository AuditLogRepository { get; }
protected IGuidGenerator GuidGenerator { get; } protected IAuditLogInfoToAuditLogConverter AuditLogInfoToAuditLogConverter { get; }
protected AuditLogRepository_Tests() protected AuditLogRepository_Tests()
{ {
AuditLogRepository = GetRequiredService<IAuditLogRepository>(); AuditLogRepository = GetRequiredService<IAuditLogRepository>();
GuidGenerator = GetRequiredService<IGuidGenerator>(); AuditLogInfoToAuditLogConverter = GetRequiredService<IAuditLogInfoToAuditLogConverter>();
} }
[Fact] [Fact]
@ -119,8 +116,8 @@ namespace Volo.Abp.AuditLogging
} }
}; };
await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1)); await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log1));
await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2)); await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log2));
//Assert //Assert
var logs = await AuditLogRepository.GetListAsync(); var logs = await AuditLogRepository.GetListAsync();
@ -223,8 +220,8 @@ namespace Volo.Abp.AuditLogging
} }
}; };
await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1)); await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log1));
await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2)); await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log2));
//Assert //Assert
var logs = await AuditLogRepository.GetCountAsync(); var logs = await AuditLogRepository.GetCountAsync();
@ -325,8 +322,8 @@ namespace Volo.Abp.AuditLogging
} }
}; };
await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1)); await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log1));
await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2)); await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log2));
//Assert //Assert
var date = DateTime.Parse("2020-01-01"); var date = DateTime.Parse("2020-01-01");
@ -428,8 +425,8 @@ namespace Volo.Abp.AuditLogging
} }
}; };
await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1)); await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log1));
await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2)); await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log2));
//Assert //Assert
var entityChanges = await AuditLogRepository.GetEntityChangeListAsync(); var entityChanges = await AuditLogRepository.GetEntityChangeListAsync();
@ -534,8 +531,8 @@ namespace Volo.Abp.AuditLogging
} }
}; };
await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1)); await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log1));
await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2)); await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log2));
var entityChanges = await AuditLogRepository.GetEntityChangeListAsync(); var entityChanges = await AuditLogRepository.GetEntityChangeListAsync();
var entityChange = var entityChange =
@ -641,8 +638,8 @@ namespace Volo.Abp.AuditLogging
} }
}; };
await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1)); await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log1));
await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2)); await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log2));
//Assert //Assert
var entityChangesDesc = await AuditLogRepository.GetEntityChangeListAsync(); var entityChangesDesc = await AuditLogRepository.GetEntityChangeListAsync();
@ -754,8 +751,8 @@ namespace Volo.Abp.AuditLogging
} }
}; };
await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1)); await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log1));
await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2)); await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log2));
//Assert //Assert
var entityChanges = await AuditLogRepository.GetEntityChangeListAsync(changeType: EntityChangeType.Created); var entityChanges = await AuditLogRepository.GetEntityChangeListAsync(changeType: EntityChangeType.Created);
@ -864,8 +861,8 @@ namespace Volo.Abp.AuditLogging
} }
}; };
await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1)); await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log1));
await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2)); await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log2));
//Assert //Assert
var entityHistory = await AuditLogRepository.GetEntityChangesWithUsernameAsync(entityId, entityType); var entityHistory = await AuditLogRepository.GetEntityChangesWithUsernameAsync(entityId, entityType);
@ -976,8 +973,8 @@ namespace Volo.Abp.AuditLogging
} }
}; };
await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1)); await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log1));
await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2)); await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log2));
var entityChanges = await AuditLogRepository.GetEntityChangeListAsync(); var entityChanges = await AuditLogRepository.GetEntityChangeListAsync();
var entityHistory = var entityHistory =

Loading…
Cancel
Save