- ABP Framework version: v7.3.0
- UI Type: MVC
- Database System: EF Core (SQL Server)
- Tiered (for MVC) or Auth Server Separated (for Angular): yes/no
- Problem:
We have a few entities that have nested objects. For example Processing Configuration entity has Payment settings object: public PaymentSettings PaymentSettings { get; set; } = new PaymentSettings(); However these are not separate tables in the database. The properties are on the processing configuration table as processingConfiguration.paymentSettings.FieldName. The issue we're having is that when we do audit logging for the entity, if we change a property that is in a nested object it isn't logging properly (see screenshot). It sees there is a change/update, but not what property has been changed or any other information. Is there a work around for this issue?
10 Answer(s)
-
0
Hi,
Could you share a simple project to reproduce the problem? thanks. my email is shiwei.liang@volosoft.com
-
0
I just sent you an example to your email. Thank you!
-
0
-
0
Ok I sent a shared link, hopefully you can open that one. Thanks!
-
0
I spent a long time downloading the file but with no success.
Could you try share the file with https://wetransfer.com/
-
0
I've emailed a few things in the hopes one of them works. I have also attached two screenshots of how we've structured our dtos that are causing the issue, and a gif so you can see that when I create or edit a contact that includes the nested dto the nested items aren't included in the audit log, the only change that shows is the one made to email which is on the contactdto not the paymentsettingsdto. The others aren't included in the log which is the issue were trying to solve for.
-
0
-
0
I sent a zipped folder through wetransfer. It wouldn't upload a non zipped one. Hopefully you'll be able to open. I have also included information two comments above if that would help any.
-
0
Hi
ABP is not supported in this case, you can try overriding the
EntityHistoryHelper
:[Dependency(ReplaceServices = true)] public class CustomEntityHistoryHelper : EntityHistoryHelper { public CustomEntityHistoryHelper(IAuditingStore auditingStore, IOptions<AbpAuditingOptions> options, IClock clock, IJsonSerializer jsonSerializer, IAuditingHelper auditingHelper) : base(auditingStore, options, clock, jsonSerializer, auditingHelper) { } protected override List<EntityPropertyChangeInfo> GetPropertyChanges(EntityEntry entityEntry) { var propertyChanges = base.GetPropertyChanges(entityEntry); foreach (ReferenceEntry reference in entityEntry.References) { if (reference.TargetEntry == null) { continue; } var referencePropertyChanges = GetPropertyChanges(reference.TargetEntry); foreach (EntityPropertyChangeInfo referencePropertyChange in referencePropertyChanges) { referencePropertyChange.PropertyName = $"{reference.Metadata.Name}.{referencePropertyChange.PropertyName}"; } propertyChanges.AddRange(referencePropertyChanges); } return propertyChanges; } }
-
0
This work around solved the issue. Thank you!