Audit.NET.RavenDB
27.3.2
dotnet add package Audit.NET.RavenDB --version 27.3.2
NuGet\Install-Package Audit.NET.RavenDB -Version 27.3.2
<PackageReference Include="Audit.NET.RavenDB" Version="27.3.2" />
paket add Audit.NET.RavenDB --version 27.3.2
#r "nuget: Audit.NET.RavenDB, 27.3.2"
// Install Audit.NET.RavenDB as a Cake Addin #addin nuget:?package=Audit.NET.RavenDB&version=27.3.2 // Install Audit.NET.RavenDB as a Cake Tool #tool nuget:?package=Audit.NET.RavenDB&version=27.3.2
Audit.NET.RavenDB
Raven DB provider for Audit.NET library (An extensible framework to audit executing operations in .NET).
Store the audit events in Raven DB collections using the RavenDB.Client library.
Install
NuGet Package To install the package run the following command on the Package Manager Console:
PM> Install-Package Audit.NET.RavenDB
Usage
Please see the Audit.NET Readme
Configuration
Set the static Audit.Core.Configuration.DataProvider
property to set the Raven DB data provider, or call the UseRavenDB
method on the fluent configuration. This should be done before any AuditScope
creation, i.e. during application startup.
For example:
Audit.Core.Configuration.DataProvider = new RavenDbDataProvider(config => config
.WithSettings("http://127.0.0.1:8080", "AuditEvents"));
Or using the constructor overload that accepts a fluent API:
Audit.Core.Configuration.DataProvider = new RavenDbDataProvider(config => config
.WithSettings(settings => settings
.Urls("http://127.0.0.1:8080")
.DatabaseDefault("AuditEvents")));
Or by using the global setup extension UseRavenDB()
that also accepts the fluent API:
Audit.Core.Configuration.Setup()
.JsonNewtonsoftAdapter()
.UseRavenDB(config => config
.WithSettings(settings => settings
.Urls("http://127.0.0.1:8080")
.Database(ev => "Audit_" + ev.EventType)
.Certificate(cert)));
You can provide the database name setting as function of the Audit Event.
You can also provide an instance of a IDocumentStore
already configured. For example:
Audit.Core.Configuration.Setup()
.UseRavenDB(config => config
.UseDocumentStore(new DocumentStore()
{
Urls = new[] {"http://127.0.0.1:8080"},
Database = "AuditEvents",
Conventions = new DocumentConventions()
{
Serialization = new NewtonsoftJsonSerializationConventions()
{
JsonContractResolver = new AuditContractResolver(),
CustomizeJsonSerializer = ser =>
{
ser.DefaultValueHandling = DefaultValueHandling.Ignore;
}
}
}
}));
IMPORTANT NOTES:
The Raven DB C# Client depends on
Newtonsoft.Json
for serialization and deserialization, so if you are targeting .NET 5.0 or higher, it is highly recommended to set up the global Newtonsoft JsonAdapter by adding the.JsonNewtonsoftAdapter()
call on your startup. For example:Audit.Core.Configuration.Setup() .JsonNewtonsoftAdapter() .UseRavenDB(...);
This data provider uses a specialized Contract Resolver (
AuditContractResolver
) that honors the decorations fromSystem.Text.Json
but still usingNewtonsfot.Json
as required by the Raven DB client. ThisIContractResolver
is added by default to the client conventions when using.WithSettings(...)
fluent API.
Provider Settings
- Urls: The RavenDB server URLs for the initial connection.
- DatabaseDefault: The name of the default database to use.
- Certificate: The certificate for secure connection.
- DatabaseFunc: A function of the
AuditEvent
that returns the name of the database to store the audit event.
Provider Properties
- DocumentStore: Gets ot sets the instance of the document store being used.
Fluent API Methods
The provider options can be set with a fluent API described by the following methods:
Connection level
- WithSettings(): Use the given RavenDB settings.
- UseDocumentStore(): Alternative to use the given RavenDB document store instance (
IDocumentStore
).
Query events
This provider implements GetEvent
and GetEventAsync
methods to obtain an audit event by id:
var event = ravenDataProvider.GetEvent("AuditEvents/3201-A");
Constraints
This provider has the following constraints:
- The table to store the audit events must exists on RavenDB.
To create a database from a Raven DB Data Provider instance you can use the DocumentStore
property, for example:
ravenProvider.DocumentStore.Maintenance.Server.Send(new CreateDatabaseOperation(new DatabaseRecord("AuditEvents")));
Product | Versions 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. |
.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 was computed. 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. |
-
.NETStandard 2.0
- Audit.NET (>= 27.3.2)
- Audit.NET.JsonNewtonsoftAdapter (>= 27.3.2)
- RavenDB.Client (>= 6.0.1)
-
net6.0
- Audit.NET (>= 27.3.2)
- Audit.NET.JsonNewtonsoftAdapter (>= 27.3.2)
- RavenDB.Client (>= 6.0.1)
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 |
---|---|---|
27.3.2 | 85 | 12/11/2024 |
27.3.1 | 80 | 12/10/2024 |
27.3.0 | 91 | 12/8/2024 |
27.2.0 | 87 | 11/23/2024 |
27.1.1 | 85 | 10/28/2024 |
27.1.0 | 94 | 10/24/2024 |
27.0.3 | 192 | 9/25/2024 |
27.0.2 | 106 | 9/19/2024 |
27.0.1 | 227 | 9/4/2024 |
27.0.0 | 112 | 9/3/2024 |
26.0.1 | 325 | 8/22/2024 |
26.0.0 | 463 | 7/19/2024 |
25.0.7 | 219 | 7/4/2024 |
25.0.6 | 98 | 6/24/2024 |
25.0.5 | 121 | 6/18/2024 |
25.0.4 | 280 | 3/24/2024 |
25.0.3 | 169 | 3/13/2024 |
25.0.2 | 125 | 3/12/2024 |
25.0.1 | 118 | 2/28/2024 |
25.0.0 | 137 | 2/16/2024 |
24.0.1 | 130 | 2/12/2024 |
24.0.0 | 127 | 2/12/2024 |
23.0.0 | 275 | 12/14/2023 |
22.1.0 | 729 | 12/9/2023 |
22.0.2 | 761 | 12/1/2023 |
22.0.1 | 151 | 11/16/2023 |
22.0.0 | 113 | 11/14/2023 |
21.1.0 | 1,167 | 10/9/2023 |
21.0.4 | 189 | 9/15/2023 |
21.0.3 | 192 | 7/9/2023 |
21.0.2 | 160 | 7/6/2023 |
21.0.1 | 513 | 5/27/2023 |
21.0.0 | 401 | 4/15/2023 |
20.2.4 | 242 | 3/27/2023 |
20.2.3 | 251 | 3/17/2023 |
20.2.2 | 234 | 3/14/2023 |
20.2.1 | 841 | 3/11/2023 |
20.2.0 | 220 | 3/7/2023 |
20.1.6 | 263 | 2/23/2023 |
20.1.5 | 275 | 2/9/2023 |
20.1.4 | 500 | 1/28/2023 |
20.1.3 | 370 | 12/21/2022 |
20.1.2 | 316 | 12/14/2022 |
20.1.1 | 327 | 12/12/2022 |
20.1.0 | 347 | 12/4/2022 |
20.0.4 | 343 | 11/30/2022 |
20.0.3 | 673 | 10/28/2022 |
20.0.2 | 419 | 10/26/2022 |
20.0.1 | 462 | 10/21/2022 |
20.0.0 | 559 | 10/1/2022 |
19.4.1 | 558 | 9/10/2022 |
19.4.0 | 495 | 9/2/2022 |
19.3.0 | 493 | 8/23/2022 |
19.2.2 | 495 | 8/11/2022 |
19.2.1 | 505 | 8/6/2022 |
19.2.0 | 583 | 7/24/2022 |
19.1.4 | 1,049 | 5/23/2022 |
19.1.3 | 483 | 5/22/2022 |
19.1.2 | 499 | 5/18/2022 |
19.1.1 | 800 | 4/28/2022 |
19.1.0 | 1,018 | 4/10/2022 |
1.6.3 | 797 | 4/6/2022 |
1.6.2 | 2,464 | 3/30/2022 |
1.6.1 | 475 | 3/30/2022 |
1.6.0 | 476 | 3/30/2022 |
1.5.0 | 750 | 2/8/2022 |
1.4.1 | 738 | 2/8/2022 |
1.4.0 | 485 | 2/7/2022 |
1.3.2 | 515 | 2/1/2022 |
1.3.1 | 514 | 1/31/2022 |
1.3.0 | 484 | 1/31/2022 |
1.2.2 | 481 | 1/31/2022 |
1.2.1 | 467 | 1/31/2022 |
1.2.0 | 485 | 1/31/2022 |
1.1.0 | 483 | 1/31/2022 |
1.0.0 | 1,095 | 1/4/2021 |