Entity Framework Core Plus Audit - Ignore Events
Problem
You need to ignore a relationship or a subset of all available events.
Solution
Ignore event properties:
- IgnoreEntityAdded
- IgnoreEntityDeleted
- IgnoreEntityModified
- IgnoreEntitySoftAdded
- IgnoreEntitySoftDeleted
- IgnoreRelationshipAdded
- IgnoreRelationshipDeleted
// using Z.EntityFramework.Plus; // Don't forget to include this. // Globally AuditManager.DefaultConfiguration.IgnoreRelationshipAdded = true; AuditManager.DefaultConfiguration.IgnoreRelationshipDeleted = true; // By Instance var audit = new Audit(); audit.CreatedBy = "ZZZ Projects"; // Optional audit.Configuration.IgnoreRelationshipAdded = true; audit.Configuration.IgnoreRelationshipDeleted = true; ctx.SaveChanges(audit);