![]() |
VOOZH | about |
dotnet add package Audit.NET.SqlServer --version 32.2.0
NuGet\Install-Package Audit.NET.SqlServer -Version 32.2.0
<PackageReference Include="Audit.NET.SqlServer" Version="32.2.0" />
<PackageVersion Include="Audit.NET.SqlServer" Version="32.2.0" />Directory.Packages.props
<PackageReference Include="Audit.NET.SqlServer" />Project file
paket add Audit.NET.SqlServer --version 32.2.0
#r "nuget: Audit.NET.SqlServer, 32.2.0"
#:package Audit.NET.SqlServer@32.2.0
#addin nuget:?package=Audit.NET.SqlServer&version=32.2.0Install as a Cake Addin
#tool nuget:?package=Audit.NET.SqlServer&version=32.2.0Install as a Cake Tool
Sql Server provider for Audit.NET library (An extensible framework to audit executing operations in .NET).
Store the audit events in a SQL Table, in JSON format.
NuGet Package To install the package run the following command on the Package Manager Console:
PM> Install-Package Audit.NET.SqlServer
π NuGet Status
π NuGet Count
Please see the Audit.NET Readme
Set the static Audit.Core.Configuration.DataProvider property to set the Sql Server data provider, or call the UseSqlServer 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 SqlDataProvider()
{
ConnectionString = "data source=localhost;initial catalog=Audit;integrated security=true;",
Schema = "dbo",
TableName = "Event",
IdColumnName = "EventId",
JsonColumnName = "JsonData",
LastUpdatedDateColumnName = "LastUpdatedDate",
CustomColumns = new List<CustomColumn>()
{
new CustomColumn("EventType", ev => ev.EventType)
}
};
Or by using the fluent configuration API:
Audit.Core.Configuration.Setup()
.UseSqlServer(config => config
.ConnectionString("data source=localhost;initial catalog=Audit;integrated security=true;")
.Schema("dbo")
.TableName("Event")
.IdColumnName("EventId")
.JsonColumnName("JsonData")
.LastUpdatedColumnName("LastUpdatedDate")
.CustomColumn("EventType", ev => ev.EventType)
.CustomColumn("User", ev => ev.Environment.UserName));
You can provide any of the settings as a function of the Audit Event, for example to use a connection string per machine, and different table names:
Audit.Core.Configuration.Setup()
.UseSqlServer(config => config
.ConnectionString(ev => GetCnnString(ev.Environment.MachineName))
.TableName(ev => ev.EventType == "Order" ? "OrderAudits" : "Audits"));
DbConnection to use, alternative to ConnectionString.This provider implements GetEvent and GetEventAsync methods to obtain an audit event by id:
var event = sqlDataProvider.GetEvent(1000);
NVARCHAR.For example:
CREATE TABLE [Event]
(
[EventId] BIGINT IDENTITY(1,1) NOT NULL,
[InsertedDate] DATETIME NOT NULL DEFAULT(GETUTCDATE()),
[LastUpdatedDate] DATETIME NULL,
[JsonData] NVARCHAR(MAX) NOT NULL,
[EventType] NVARCHAR(100) NOT NULL,
CONSTRAINT PK_Event PRIMARY KEY (EventId)
)
GO
If you use Azure SQL Server or Sql Server 2016, you can create indexes on the JSON fields, for example creating a schemabinded view:
CREATE VIEW dbo.[v_Event] WITH SCHEMABINDING
AS
SELECT EventId,
InsertedDate,
CAST(JSON_VALUE(JsonData, '$.EventType') AS NVARCHAR(255)) AS [EventType],
CAST(JSON_VALUE(JsonData, '$.ReferenceId') AS NVARCHAR(255)) AS [ReferenceId],
JSON_VALUE(JsonData, '$.Target.Type') As [TargetType],
COALESCE(JSON_VALUE(JsonData, '$.Target.Old'), JSON_QUERY(JsonData, '$.Target.Old')) AS [TargetOld],
COALESCE(JSON_VALUE(JsonData, '$.Target.New'), JSON_QUERY(JsonData, '$.Target.New')) AS [TargetNew],
JSON_QUERY(JsonData, '$.Comments') AS [Comments],
[JsonData]
FROM dbo.[Event]
GO
CREATE UNIQUE CLUSTERED INDEX PK_V_EVENT ON [v_Event] (EventId)
GO
CREATE INDEX IX_V_EVENT_EventType_ReferenceId ON [v_Event] (EventType, ReferenceId)
GO
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.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 is compatible. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 is compatible. |
| .NET Framework | net461 net461 was computed. net462 net462 is compatible. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on Audit.NET.SqlServer:
| Package | Downloads |
|---|---|
|
BIA.Net.Core.Infrastructure.Data
Infrastructure Data layer classes for BIA.Net Core Framework |
|
|
BIA.Net.Core.Ioc
IOC Container layer classes for BIA.Net Core Framework |
|
|
BIA.Net.Core.Test
Unit test classes for BIA.Net Core Framework |
|
|
Segugio
Una libreria per la gestione di audit con piΓΉ provider. |
|
|
Jetstream.Infrastructure.Audit
Project that contains the classes and interfaces used in creating a base auditing structure for API projects. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 32.2.0 | 459 | 6/12/2026 |
| 32.1.1 | 4,141 | 6/1/2026 |
| 32.1.0 | 5,713 | 5/7/2026 |
| 32.0.0 | 70,704 | 1/8/2026 |
| 31.3.3 | 3,899 | 12/31/2025 |
| 31.3.2 | 11,575 | 12/20/2025 |
| 31.3.1 | 4,041 | 12/9/2025 |
| 31.3.0 | 844 | 12/5/2025 |
| 31.2.0 | 1,915 | 11/27/2025 |
| 31.1.0 | 1,062 | 11/26/2025 |
| 31.0.2 | 40,013 | 10/2/2025 |
| 31.0.1 | 21,596 | 8/28/2025 |
| 31.0.0 | 11,851 | 8/22/2025 |
| 30.1.3 | 2,339 | 8/19/2025 |
| 30.1.2 | 921 | 8/14/2025 |
| 30.1.1 | 616 | 8/13/2025 |
| 30.0.2 | 155,120 | 6/26/2025 |
| 30.0.1 | 13,531 | 5/29/2025 |
| 30.0.0 | 1,626 | 5/27/2025 |
| 29.0.1 | 11,246 | 5/8/2025 |