OptOut of Stored Procedures? #699
Unanswered
StarGazer202424
asked this question in
Q&A
Replies: 2 comments 8 replies
-
Are you referring to events generated with the Audit Command Interceptor? |
Beta Was this translation helpful? Give feedback.
2 replies
-
The command interceptor has no knowledge of the .NET entity classes, so there's no way to opt out by class. However, when using the AuditCommandInterceptor, you have additional options to filter or discard events.
optionsBuilder.AddInterceptors(new AuditCommandInterceptor()
{
IncludeReaderEventsPredicate = cmd => cmd.CommandSource != CommandSource.FromSqlQuery || !cmd.Command.CommandText.Contains("GetPickList")
});
Audit.Core.Configuration.AddCustomAction(ActionType.OnScopeCreated, scope =>
{
var cmdEvent = scope.GetCommandEntityFrameworkEvent();
if (cmdEvent?.CommandSource == CommandSource.FromSqlQuery && cmdEvent.CommandText.Contains("GetPickList"))
{
scope.Discard();
}
}); |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi
I have some Stored Procedures and I do not want to log into my audit.log. Most of them are just grabbing predefined lists.
Some of these SP are being called using EF Core and some are using Ado.net.
Is there something built in to filter these out like I can do with "optout" on classes?
Beta Was this translation helpful? Give feedback.
All reactions