Audit.NET.Polly 31.0.1

dotnet add package Audit.NET.Polly --version 31.0.1
                    
NuGet\Install-Package Audit.NET.Polly -Version 31.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Audit.NET.Polly" Version="31.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Audit.NET.Polly" Version="31.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Audit.NET.Polly" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Audit.NET.Polly --version 31.0.1
                    
#r "nuget: Audit.NET.Polly, 31.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Audit.NET.Polly@31.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Audit.NET.Polly&version=31.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Audit.NET.Polly&version=31.0.1
                    
Install as a Cake Tool

Audit.NET.Polly

Resilience wrapper Data Provider for Audit.NET library

Allows to define Polly resilience strategies to any Data Provider within Audit.NET.

Install

NuGet Package

To install the package, run the following command on the Package Manager Console:

PM> Install-Package Audit.NET.Polly

NuGet Status NuGet Count

Usage

Please see the Audit.NET Readme

Configuration

To set the Polly data provider globally, call the UsePolly() method on the fluent configuration API:

Audit.Core.Configuration.Setup()
    .UsePolly(polly => polly
        .DataProvider(...)
        .WithResilience(r => r...)

For instance, to establish a retry policy for a RavenDB data provider, ensuring that insert/replace operations are retried no more than twice in the event of a RavenException:

var ravenDbProvider = new RavenDbDataProvider(r => r
    .WithSettings(s => s
        .Urls("http://127.0.0.1:8080")
        .Database(_ => "Audit")));

Audit.Core.Configuration.Setup()
    .UsePolly(p => p
        .DataProvider(ravenDbProvider)
        .WithResilience(resilience => resilience
            .AddRetry(new()
            {
                ShouldHandle = new PredicateBuilder().Handle<RavenException>(),
                Delay = TimeSpan.FromSeconds(1),
                MaxRetryAttempts = 2
            })));

Extension for Fallback

To facilitate the fallback to a different Data Provider you can use the FallbackToDataProvider() extension method in the FallbackAction.

For instance, to establish a fallback policy for a RavenDB data provider, ensuring that in the event of a RavenException, the Audit Events will be written to a file using a File data provider as a fallback:

using Audit.Polly;

var ravenDbProvider = new RavenDbDataProvider(...);
var fallbakDbProvider = new FileDataProvider(...);

Audit.Core.Configuration.Setup()
    .UsePolly(p => p
        .DataProvider(ravenDbProvider)
        .WithResilience(resilience => resilience
            .AddFallback(new()
            {
                ShouldHandle = new PredicateBuilder().Handle<RavenException>(),
                FallbackAction = args => args.FallbackToDataProvider(fallbakDbProvider)
            })));

Extension for hedging

To facilitate the hedging strategy you can use the FallbackToDataProvider() extension method in the ActionGenerator.

For instance, to establish a hedging policy for a data provider so in case of exceptions, the Audit Events will be written to a different data provider using a hedging strategy:

using Audit.Polly;

var primaryDataProvider = new SqlDataProvider(...);
var secondaryDataProvider = new FileDataProvider(...);

Audit.Core.Configuration.Setup()
    .UsePolly(p => p
        .DataProvider(primaryDataProvider)
        .WithResilience(r => r
            .AddHedging(new()
            {
                ShouldHandle = new PredicateBuilder().Handle<SqlException>(),
                MaxHedgedAttempts = 2,
                Delay = TimeSpan.Zero,
                ActionGenerator = args => args.FallbackToDataProvider(secondaryDataProvider)
            }));

Settings

  • DataProvider: The primary data provider to use.
  • WithResilience: The resilience strategy to apply to the primary data provider. It can be a single policy or a collection of policies.

Resilience Strategies

The following are some of the available resilience policies to apply to the primary data provider.

  • AddRetry: Adds a retry policy to the primary data provider.
  • AddFallback: Adds a fallback policy to the primary data provider.
  • AddCircuitBreaker: Adds a circuit breaker policy to the primary data provider.
  • AddTimeout: Adds a timeout policy to the primary data provider.
  • AddHedging: Adds a hedging policy to the primary data provider.

Please refer to Polly documentation for a complete list.

ZZZ Projects - Sponsorship

Entity Framework Extensions and Dapper Plus are major sponsors and are proud to contribute to the development of Audit.NET

Combine the power of auditing with the speed of Bulk Operations to get the best of both worlds — audit and performance.

Entity Framework Extensions - Sponsor

Dapper Plus - Sponsor

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
31.0.1 184 8/28/2025
31.0.0 108 8/22/2025
30.1.3 126 8/19/2025
30.1.2 134 8/14/2025
30.1.1 199 8/13/2025
30.0.2 756 6/26/2025
30.0.1 349 5/29/2025
30.0.0 163 5/27/2025
29.0.1 159 5/8/2025
29.0.0 159 5/6/2025
28.0.0 159 5/5/2025
27.5.3 163 4/23/2025
27.5.2 365 4/9/2025
27.5.1 92 4/4/2025
27.5.0 3,323 3/5/2025
27.4.1 139 2/9/2025
27.4.0 3,765 1/29/2025
27.3.3 1,779 1/21/2025
27.3.2 10,783 12/11/2024
27.3.1 104 12/10/2024
27.3.0 126 12/8/2024
27.2.0 1,012 11/23/2024
27.1.1 983 10/28/2024
27.1.0 372 10/24/2024
27.0.3 3,094 9/25/2024
27.0.2 355 9/19/2024
27.0.1 1,514 9/4/2024
27.0.0 131 9/3/2024
26.0.1 235 8/22/2024
26.0.0 2,380 7/19/2024
25.0.7 172 7/4/2024
25.0.6 182 6/24/2024
25.0.5 1,121 6/18/2024
25.0.4 2,044 3/24/2024
25.0.3 164 3/13/2024
25.0.2 242 3/12/2024
25.0.1 143 2/28/2024
25.0.0 339 2/16/2024
24.0.1 169 2/12/2024
24.0.0 168 2/12/2024