Skip to content

Skip storing "Target"."Old" and "Environment" in the underlying store. #525

Answered by thepirat000
buczkow asked this question in Q&A
Discussion options

You must be logged in to vote

One option is to set up a Custom Action to remove the data you don't need, for example:

Audit.Core.Configuration.AddOnSavingAction(scope =>
{
    scope.Event.Environment = null;
    if (scope.Event.Target?.Old != null)
    {
        scope.Event.Target.Old = null;
    }
});

If you are not using Target.Old, maybe it's better to just use a Custom Field, for example to create a field named "Order":

using var scope = AuditScope.Create("Event Type", null, new { Order = order });

or

using var scope = AuditScope.Create("Event Type", null);
scope.SetCustomField("Order", order);

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by buczkow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants