Fix ExtraProperties erorrs on the audit log module

pull/6114/head
Halil İbrahim Kalkan 5 years ago
parent f475d42989
commit bb49c74761

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using Volo.Abp.Auditing;
using Volo.Abp.Data;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Guids;
using Volo.Abp.MultiTenancy;
@ -55,12 +56,12 @@ namespace Volo.Abp.AuditLogging
protected AuditLog()
{
ExtraProperties = new Dictionary<string, object>();
}
public AuditLog(IGuidGenerator guidGenerator, AuditLogInfo auditInfo)
: base(guidGenerator.Create())
{
Id = guidGenerator.Create();
ApplicationName = auditInfo.ApplicationName.Truncate(AuditLogConsts.MaxApplicationNameLength);
TenantId = auditInfo.TenantId;
TenantName = auditInfo.TenantName.Truncate(AuditLogConsts.MaxTenantNameLength);
@ -79,10 +80,14 @@ namespace Volo.Abp.AuditLogging
ImpersonatorUserId = auditInfo.ImpersonatorUserId;
ImpersonatorTenantId = auditInfo.ImpersonatorTenantId;
ExtraProperties = auditInfo
.ExtraProperties?
.ToDictionary(pair => pair.Key, pair => pair.Value)
?? new Dictionary<string, object>();
ExtraProperties = new ExtraPropertyDictionary();
if (auditInfo.ExtraProperties != null)
{
foreach (var pair in auditInfo.ExtraProperties)
{
ExtraProperties.Add(pair.Key, pair.Value);
}
}
EntityChanges = auditInfo
.EntityChanges?

@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Volo.Abp.Auditing;
using Volo.Abp.Data;
using Volo.Abp.Domain.Entities;
@ -25,11 +23,10 @@ namespace Volo.Abp.AuditLogging
public virtual int ExecutionDuration { get; protected set; }
public virtual Dictionary<string, object> ExtraProperties { get; protected set; }
public virtual ExtraPropertyDictionary ExtraProperties { get; protected set; }
protected AuditLogAction()
{
ExtraProperties = new Dictionary<string, object>();
}
public AuditLogAction(Guid id, Guid auditLogId, AuditLogActionInfo actionInfo, Guid? tenantId = null)
@ -40,7 +37,7 @@ namespace Volo.Abp.AuditLogging
AuditLogId = auditLogId;
ExecutionTime = actionInfo.ExecutionTime;
ExecutionDuration = actionInfo.ExecutionDuration;
ExtraProperties = actionInfo.ExtraProperties.ToDictionary(pair => pair.Key, pair => pair.Value);
ExtraProperties = new ExtraPropertyDictionary(actionInfo.ExtraProperties);
ServiceName = actionInfo.ServiceName.TruncateFromBeginning(AuditLogActionConsts.MaxServiceNameLength);
MethodName = actionInfo.MethodName.TruncateFromBeginning(AuditLogActionConsts.MaxMethodNameLength);
Parameters = actionInfo.Parameters.Length > AuditLogActionConsts.MaxParametersLength ? "" : actionInfo.Parameters;

@ -28,16 +28,16 @@ namespace Volo.Abp.AuditLogging
public virtual ICollection<EntityPropertyChange> PropertyChanges { get; protected set; }
public virtual Dictionary<string, object> ExtraProperties { get; protected set; }
public virtual ExtraPropertyDictionary ExtraProperties { get; protected set; }
protected EntityChange()
{
ExtraProperties = new Dictionary<string, object>();
ExtraProperties = new ExtraPropertyDictionary();
}
public EntityChange(
IGuidGenerator guidGenerator,
Guid auditLogId,
IGuidGenerator guidGenerator,
Guid auditLogId,
EntityChangeInfo entityChangeInfo,
Guid? tenantId = null)
{
@ -55,10 +55,14 @@ namespace Volo.Abp.AuditLogging
.ToList()
?? new List<EntityPropertyChange>();
ExtraProperties = entityChangeInfo
.ExtraProperties?
.ToDictionary(pair => pair.Key, pair => pair.Value)
?? new Dictionary<string, object>();
ExtraProperties = new ExtraPropertyDictionary();
if (entityChangeInfo.ExtraProperties != null)
{
foreach (var pair in entityChangeInfo.ExtraProperties)
{
ExtraProperties.Add(pair.Key, pair.Value);
}
}
}
}
}

Loading…
Cancel
Save