ConcreteAudit 1.4.0

dotnet add package ConcreteAudit --version 1.4.0                
NuGet\Install-Package ConcreteAudit -Version 1.4.0                
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="ConcreteAudit" Version="1.4.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ConcreteAudit --version 1.4.0                
#r "nuget: ConcreteAudit, 1.4.0"                
#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 ConcreteAudit as a Cake Addin
#addin nuget:?package=ConcreteAudit&version=1.4.0

// Install ConcreteAudit as a Cake Tool
#tool nuget:?package=ConcreteAudit&version=1.4.0                

Concorete Audit

Automaticly track and audit all of your changes that are occured in a specified DbContext. this package is provider ignorant and only cares about the db context

Usage

1- Decorate your entity with [Auditable()] attribute 2- your AppDbContext should inherite AuditDbContext and implement the constructor 3- in startup / program file you should inject it via AddAuditDbContext extension method, or you can inject it as scoped 4- you can use AuditDbContextOption for furture configuring CAudit behavior

some configs are done inside [Auditable()] attribute

5- use contex.Audit<entity>(n=> n.predicate == true) to query the data 6- there are 3 properties in Audit<entity> class that help you see the data:

audited.CurrentDataData 
audited.OldData 
audited.Data : always carry the most relevent data, in insert and update it is CurrentData and if deleted it is OldData

Audit patterns

you can have both Old and New data or only retaine new data.

to achive that you may use the optional parameter pattern in [Auditable()]

Updating:

if CAudit tracks a update change, the pre-modification data will be stored in OldData and post-modification inside CurrentData.

Inserting:

if CAudit tracks an insert, you can see it inside CurrentData.

Deleting:

if CAudit tracks a deleting opration, pre deleting data will be stored in OldData and CurrentData will be null-defualt.

KeepNew

in this case CAudit dont care about the previuos state of entity

KeepNewAndOld

if you set it as -KeepNewAndOld-, the audit record will behave like this in each scenario:

Note: these options dont alter audit.Data behavior or content

Product Compatible and additional computed target framework versions.
.NET 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. 
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.4.0 3,237 11/19/2022
1.3.5 1,429 8/6/2022
1.3.4 423 8/6/2022
1.3.3 417 8/6/2022
1.3.2 466 8/2/2022
1.3.1 532 7/24/2022
1.3.0 950 4/19/2022
1.2.5 441 4/19/2022
1.2.1 425 4/19/2022
1.2.0 456 2/16/2022
1.1.0 493 2/14/2022 1.1.0 is deprecated because it has critical bugs.
1.0.0 515 1/26/2022 1.0.0 is deprecated because it has critical bugs.