SimpleAuditor 1.0.16

There is a newer version of this package available.
See the version list below for details.
dotnet add package SimpleAuditor --version 1.0.16                
NuGet\Install-Package SimpleAuditor -Version 1.0.16                
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="SimpleAuditor" Version="1.0.16" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SimpleAuditor --version 1.0.16                
#r "nuget: SimpleAuditor, 1.0.16"                
#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.
// Install SimpleAuditor as a Cake Addin
#addin nuget:?package=SimpleAuditor&version=1.0.16

// Install SimpleAuditor as a Cake Tool
#tool nuget:?package=SimpleAuditor&version=1.0.16                

SimpleAuditor

Build StatusLicense: MIT NuGet Badge

Simple EntityFrameWorkCore Audit Log

About SimpleAuditor

SimpleAuditor is an audit library that enables you log changes made on your tables by simply putting the Audit attribute on the tables. The library makes it easy to log changes and also allows for override of the method of getting who effected the change.

How to use

To use SimpleAuditor , add it by searching on Nuget manager or use the install command below

Install-Package SimpleAuditor

Run the SQL script to create the AuditTrail and AuditTrail tables in your Database

https://github.com/msdkool/auditor/tree/master/DbScript

Your DbContext should inherit from the AuditContext

public class ExampleDbContext : AuditContext
{
        [Audit]
        public DbSet<Person> Person { get; set; }

        public ExampleDbContext(DbContextOptions<ExampleDbContext> options) : base(options)
        {

        }

        public override string GetUserName()
        {
            return "TestUser";
        }
}

In the example above the Person entity has been marked for Audit, SimpleAuditor will automatically detect this when a change is made and save whatever change is effected.

GetUserName method

By default the library will attempt to access the IHttpContextAccessor to fetch the identity of the person carrying out the action. The library allows you override that method in order to provide a custom GetUserName.

Sample Code

The sample code can be found in the link below

https://github.com/msdkool/auditor/tree/master/Src/Auditor.Console

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 is compatible.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 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
1.0.26 418 12/14/2020
1.0.25 389 12/10/2020
1.0.25-pullrequest0003-0002 295 12/10/2020
1.0.25-alpha0001 276 12/10/2020
1.0.16 431 7/28/2020
1.0.15 404 7/28/2020
1.0.15-alpha0002 288 7/28/2020
1.0.15-alpha0001 294 7/28/2020
1.0.14.490 388 7/28/2020
1.0.14-alpha0010.488 319 7/28/2020

- audit log for entities