I'm in the process of implementing Auditing with Audit.NET and Entity Framework with an MVC application running .NET 4.6.1.
I have a requirement to be able to restrict auditing based on the database operation being performed. I've reviewed the documentation and see that I can control this via the AuditEntityAction by writing custom code.
What I'm looking for is the ability to attribute my data models to indicate which operations should be audited. I can create this logic if it doesn't exist but thought I'd check with the dev community first. Below is an example of what I'm looking for.
[AuditInclude("DELETE")]
or
[AuditInclude("DELETE", "UPDATE")]
You can make the function
AuditEntityAction
to return a boolean to indicate whether to include (true) or ignore (false) the entity on the output log.For example: