Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
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)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    We have an issue for ABP here <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/447">https://github.com/aspnetboilerplate/as ... issues/447</a> but we couldn't work on it yet.

    You can override ApplyAbpConcepts or SaveChanges in your DbContext and write your custom code in it as you like.