Base solution for your next web application
Open Closed

Adding enity Audit Trial support in Existing boilerplate co #2849


User avatar
0
sajid created

Hello there,

In our application we want to implement Audit Trial (history of changes in entities with old & new values) in our database tables. In current ABP under "AbpDbContext" class we have a ApplyAbpConcepts() function which is been called from SaveChanges() and SaveChangesAsync(CancellationToken cancellationToken) methods . ApplyAbpConcepts() is the place where we can do something to fetch all OriginalValues and CurrentValues to create/fill our AuditLog entity. Following is a sample code which we will use to get original and current values -

foreach (var prop in entry.OriginalValues.PropertyNames)
{
var originalValue = entry.OriginalValues[prop].ToString();
var currentValue = entry.CurrentValues[prop].ToString();
}
My doubt is, how I can achieve it in my ASP.Net Zero application? I want to store this entity from my abpDbContext class. Will it be possible store my custom entity (i.e. AuditHistory or auditLog which we will create) from my abpDbContext class ?

Or what will be the best approach to integrate this functionality ? Because as of now, there is no such Audit trial functionality is supported in existing framework.


1 Answer(s)