With ABP Framework, when entity data is changed, it is written to AbpEntityChanges and AbpEntityPropertyChanges table.
Is the a way intercept Abp's implementation, so that we can do this: Get Old Entity Instance value, Get new Entity Instance value, this entity change is triggered via which API and by who. Then we sent whole data to an event bus.
Thanks
- ABP Framework version: v7.2.1 Micro Service *:
3 Answer(s)
-
0
Hi,
Yes, you can create an
AuditLogContributor.
https://docs.abp.io/en/abp/latest/Audit-Logging#audit-log-contributors
For example:
public class MyAuditLogContributor : AuditLogContributor { public override void PostContribute(AuditLogContributionContext context) { var distributedEventBus = context.ServiceProvider.GetRequiredService<IDistributedEventBus>(); foreach (var entityChange in context.AuditInfo.EntityChanges) { foreach (var propertyChange in entityChange.PropertyChanges) { var oldValue = propertyChange.OriginalValue; var newValue = propertyChange.NewValue; distributedEventBus.PublishAsync(...) } } } }
-
0
Can ABP framework put Snapshot of old entity instance and new instance ExtraProperties in JSON format. Since sometimes, there is such audit requirement. For example, previous form submitter is A, new submitter is still A, this property is not changed. However, for audit perspective, the app needs to show who make such changes or even for property is not changed, the snapshot value should still show on the UI.
-
0
Hi,
You can do it yourself.