Replies: 1 comment
-
It's difficult to determine with the limited information provided. You can add custom fields to the EventEntry, but not to the EventEntryChange. For example, from the audit entity action: Audit.Core.Configuration.Setup()
.UseEntityFramework(_ => _
.UseDbContext<MyContext>()
.AuditTypeMapper(t => typeof(AuditLog))
.AuditEntityAction<AuditLog>((ev, entry, entity) =>
{
entry.CustomFields["Annotations"] = GetAnnotations(entry);
})); You'll need to implement the GetAnnotations method to retrieve the necessary data for each column from the entry. For example, you could do something like this: private List<Annotation> GetAnnotations(EventEntry entry)
{
return entry.Changes.ConvertAll(change =>
new
{
ColumnName = change.ColumnName,
OverridenColumnName = GetOverridenColumnName(change.ColumnName, entry.GetEntry())
});
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, can i somehow add property to fired EntityFrameworkEvent? to EventEntryChange, like overrided ColumName from annotation.
I need to store user friendly name for changes history in db. Now my best idea store dictionary with table+columnName keys and search for every changed field. But this dont sounds good)
Or mb i should go some other way?
Thank you in advance
Beta Was this translation helpful? Give feedback.
All reactions