I have the following Setup
Audit.Core.Configuration.Setup() // Triggered on a database save.
.UseEntityFramework(ef => ef
.AuditTypeExplicitMapper(m => m
.Map<Item, AuditLog>()
.AuditEntityAction<AuditLog>((evt, entry, auditEntity) =>
{
auditEntity.AuditData = entry.ToJson();
auditEntity.AuditDate = DateTime.UtcNow;
auditEntity.CallingMethod = "Calling Method"; <-- Where I need the calling method.
})
)
);
public async Task DoSomeWork() { //<--- I want to get "DoSomeWork"
// Some work..
await dbConn.SaveChangesAsync();
return updated;
}
How can I get access to the method which called .saveChangesAsync so I know where it was triggered from? I've checked using StackTrace
however that is flooded with library level frames which are not very helpful and I can't find the correct parent method.
I see in evt
there is a that it provides a calling parent name, however that is just one level up so is just the "SaveChangesAsync" method.
Thanks