Skip to content

Commit

Permalink
fix: adjust audit entity creation (#1122)
Browse files Browse the repository at this point in the history
* fix audit-expression-creation to accommodate changes in updated audit-package
Refs: #1121
  • Loading branch information
Phil91 authored Nov 11, 2024
1 parent 4f2627d commit be67c8a
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ private static MemberInitExpression CreateAuditEntityExpression<TAuditEntity>(IE
{
var memberBindings = sourceProperties.Select(p =>
CreateMemberAssignment(typeof(TAuditEntity).GetMember(p.Name)[0], Expression.Property(entity, p)))
.Append(CreateMemberAssignment(typeof(TAuditEntity).GetMember(AuditPropertyV1Names.AuditV1Id.ToString())[0], Expression.New(typeof(Guid))))
.Append(CreateMemberAssignment(typeof(TAuditEntity).GetMember(AuditPropertyV1Names.AuditV1Id.ToString())[0], Expression.Call(typeof(Guid).GetMethod(nameof(Guid.NewGuid), BindingFlags.Public | BindingFlags.Static)!)))
.Append(CreateMemberAssignment(typeof(TAuditEntity).GetMember(AuditPropertyV1Names.AuditV1OperationId.ToString())[0], Expression.Constant(auditOperationId)))
.Append(CreateMemberAssignment(typeof(TAuditEntity).GetMember(AuditPropertyV1Names.AuditV1DateLastChanged.ToString())[0], Expression.New(typeof(DateTimeOffset))));
.Append(CreateMemberAssignment(typeof(TAuditEntity).GetMember(AuditPropertyV1Names.AuditV1DateLastChanged.ToString())[0], Expression.MakeMemberAccess(null, typeof(DateTimeOffset).GetProperty(nameof(DateTimeOffset.UtcNow))!)));

if (lastEditorProperty != null)
{
Expand Down

0 comments on commit be67c8a

Please sign in to comment.