mirror of https://github.com/abpframework/abp.git
8 changed files with 109 additions and 36 deletions
@ -1,21 +1,24 @@ |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Auditing; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Guids; |
|||
|
|||
namespace Volo.Abp.AuditLogging |
|||
{ |
|||
public class AuditingStore : IAuditingStore, ITransientDependency |
|||
{ |
|||
private readonly IAuditLogRepository _auditLogRepository; |
|||
private readonly IGuidGenerator _guidGenerator; |
|||
|
|||
public AuditingStore(IAuditLogRepository auditLogRepository) |
|||
public AuditingStore(IAuditLogRepository auditLogRepository, IGuidGenerator guidGenerator) |
|||
{ |
|||
_auditLogRepository = auditLogRepository; |
|||
_guidGenerator = guidGenerator; |
|||
} |
|||
|
|||
public async Task SaveAsync(AuditLogInfo auditInfo) |
|||
{ |
|||
await _auditLogRepository.InsertAsync(new AuditLog(auditInfo)); |
|||
await _auditLogRepository.InsertAsync(new AuditLog(_guidGenerator, auditInfo)); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,35 @@ |
|||
using System; |
|||
using Volo.Abp.Auditing; |
|||
using Volo.Abp.Domain.Entities; |
|||
using Volo.Abp.Guids; |
|||
|
|||
namespace Volo.Abp.AuditLogging |
|||
{ |
|||
public class EntityPropertyChange : Entity<Guid> |
|||
{ |
|||
public virtual Guid EntityChangeId { get; protected set; } |
|||
|
|||
public virtual string NewValue { get; protected set; } |
|||
|
|||
public virtual string OriginalValue { get; protected set; } |
|||
|
|||
public virtual string PropertyName { get; protected set; } |
|||
|
|||
public virtual string PropertyTypeFullName { get; protected set; } |
|||
|
|||
protected EntityPropertyChange() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public EntityPropertyChange(IGuidGenerator guidGenerator, Guid entityChangeId, EntityPropertyChangeInfo entityChangeInfo) |
|||
{ |
|||
EntityChangeId = entityChangeId; |
|||
Id = guidGenerator.Create(); |
|||
NewValue = entityChangeInfo.NewValue; |
|||
OriginalValue = entityChangeInfo.OriginalValue; |
|||
PropertyName = entityChangeInfo.PropertyName; |
|||
PropertyTypeFullName = entityChangeInfo.PropertyTypeFullName; |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue