itmannz
itmannz

Reputation: 599

Audit for EF Core

I would like to implement audit functionality using EF Core.

I mean would like to log every transaction/action such as Create, update and delete in DB table.

I have searched on google and found some library and solution.

https://www.nuget.org/packages/Audit.EntityFramework.Core/

https://beeming.net/data/2017/1/easily-adding-auditing-to-a-entity-framework-code-first-project

Can some one suggest me best practices for auditing for EF Core Note: I am using EF Core 2.X

Upvotes: 2

Views: 2945

Answers (1)

Robert Perry
Robert Perry

Reputation: 1956

The basic process for auditing is to override the SaveChanges() method on the DbContext and plug in some logic. The DbContext has a ChangeTracker property that makes it super easy to access the before and after values

Upvotes: 2

Related Questions