Hasim.Auditify 0.1.6

dotnet add package Hasim.Auditify --version 0.1.6
                    
NuGet\Install-Package Hasim.Auditify -Version 0.1.6
                    
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="Hasim.Auditify" Version="0.1.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Hasim.Auditify" Version="0.1.6" />
                    
Directory.Packages.props
<PackageReference Include="Hasim.Auditify" />
                    
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 Hasim.Auditify --version 0.1.6
                    
#r "nuget: Hasim.Auditify, 0.1.6"
                    
#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 Hasim.Auditify@0.1.6
                    
#: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=Hasim.Auditify&version=0.1.6
                    
Install as a Cake Addin
#tool nuget:?package=Hasim.Auditify&version=0.1.6
                    
Install as a Cake Tool

Auditify

Build NuGet NuGet Downloads .NET License

A lightweight, pluggable audit-trail library for Entity Framework Core 8+.

Auditify automatically captures entity changes (Added / Modified / Deleted) in your EF Core DbContext and persists them as structured audit logs. It hooks in via an EF Core SaveChangesInterceptor, supports sensitive-data masking, and is wired up through the Hasim.Injectify module system.

🇬🇧 English

Overview

Auditify inspects the ChangeTracker right before SaveChanges runs and writes one AuditLog per audited entity, each with granular EntityChange records (property, old value, new value). Values of sensitive properties are masked.

Features

  • Automatic audit logging — via an EF Core SaveChangesInterceptor (PersistingAuditInterceptor)
  • Sensitive data maskingPassword, Token, Secret, ApiKey, ConnectionString are masked by default (configurable)
  • Structured logsAuditLog + EntityChange (old/new values)
  • ConfigurableAuditifyOptions for fine-grained control
  • DI-ready — registered through the Injectify AuditModule
  • .NET 8 — built for the latest .NET

Installation

dotnet add package Hasim.Auditify

Quick Start

1. Register the Injectify module

AuditModule registers PersistingAuditInterceptor, IAuditService and the audit core services. Register it either explicitly or via auto-discovery:

// Explicit registration
builder.Services.AddInjectifyModules(builder.Configuration, new AuditModule());

// OR auto-discovery (scans app + referenced assemblies)
builder.InjectifyApplication();
2. Add the interceptor to your own DbContext
builder.Services.AddDbContext<YourDbContext>((sp, options) =>
    options.UseSqlServer(connectionString)
           .AddInterceptors(sp.GetRequiredService<PersistingAuditInterceptor>()));
3. Save — audit is created automatically
await dbContext.AddAsync(entity);
await dbContext.SaveChangesAsync(); // interceptor writes the audit log

Customize options

builder.Services.Configure<AuditifyOptions>(options =>
{
    options.SensitiveProperties = ["Password", "Token", "Secret", "ApiKey", "ConnectionString"];
    options.TrackIpAddress = true;
    options.TrackCorrelationId = true;
    options.AuditLogsTableName = "MyAuditLogs";
    options.EntityChangesTableName = "MyEntityChanges";
});

Testing

The test project uses PeasyPilot on .NET 8:

  • PeasyPilot.Core for fluent assertions.
  • PeasyPilot.Moq for mocks.
  • PeasyPilot.XUnit and PeasyPilotTestBase for xUnit integration and test context.

The xUnit and Moq dependencies are supplied transitively by PeasyPilot packages.

Architecture

┌────────────────────────────────────────────┐
│             Your Application                │
├────────────────────────────────────────────┤
│  Auditify                                   │
│  ├── Core (AuditService, AuditChangeBuilder)│
│  ├── EF Core (PersistingAuditInterceptor)   │
│  ├── Configuration (AuditifyOptions)        │
│  └── DI (AuditModule via Injectify)         │
└────────────────────────────────────────────┘

Namespaces

Namespace Role
Auditify.Abstractions Interfaces (IAuditService, IAuditChangeBuilder, IAuditEntityFilter, IAuditValueFormatter, IAuditableEntity, ISoftDelete, …)
Auditify.Core Core implementations (AuditService, AuditChangeBuilder, AuditValueFormatter, AuditEntityFilter)
Auditify.Entities Entity models (AuditLog, EntityChange, User)
Auditify.EntityFrameworkCore EF Core integration (PersistingAuditInterceptor, configurations)
Auditify.Configuration Options (AuditifyOptions)
Auditify.Module Injectify DI module (AuditModule)

Entity model

  • AuditLog — one audit record per audited entity change: UserId, Action (Added/Modified/Deleted), EntityName, Timestamp, optional IpAddress / CorrelationId, and a collection of EntityChange.
  • EntityChange — property-level detail: PropertyName, OldValue, NewValue.

Notes on ISoftDelete / IAuditableEntity

These abstractions are provided for soft-delete and timestamp patterns, but they are not applied automatically by the interceptor. Apply them in your own entity logic if needed.


🇫🇷 Français

Vue d'ensemble

Auditify capture automatiquement les modifications d'entités (Ajoutées / Modifiées / Supprimées) dans votre DbContext EF Core et les persiste sous forme de journaux d'audit structurés. Il s'intègre via un SaveChangesInterceptor EF Core, prend en charge le masquage des données sensibles et se câble via le système de modules Hasim.Injectify.

Fonctionnalités

  • Journalisation automatique — via un SaveChangesInterceptor EF Core (PersistingAuditInterceptor)
  • Masquage des données sensiblesPassword, Token, Secret, ApiKey, ConnectionString sont masqués par défaut (configurable)
  • Journaux structurésAuditLog + EntityChange (ancienne/nouvelle valeur)
  • ConfigurableAuditifyOptions pour un contrôle fin
  • Prêt pour l'injection de dépendances — enregistré via le AuditModule d'Injectify
  • .NET 8 — construit pour la dernière version de .NET

Installation

dotnet add package Hasim.Auditify

Démarrage rapide

1. Enregistrer le module Injectify

AuditModule enregistre PersistingAuditInterceptor, IAuditService et les services d'audit. Enregistrez-le explicitement ou par auto-découverte :

// Enregistrement explicite
builder.Services.AddInjectifyModules(builder.Configuration, new AuditModule());

// OU auto-découverte (scanne les assemblys applicatifs et référencés)
builder.InjectifyApplication();
2. Ajouter l'intercepteur à votre propre DbContext
builder.Services.AddDbContext<VotreDbContext>((sp, options) =>
    options.UseSqlServer(connectionString)
           .AddInterceptors(sp.GetRequiredService<PersistingAuditInterceptor>()));
3. Enregistrez — l'audit est créé automatiquement
await dbContext.AddAsync(entity);
await dbContext.SaveChangesAsync(); // l'intercepteur écrit le journal d'audit

Personnaliser les options

builder.Services.Configure<AuditifyOptions>(options =>
{
    options.SensitiveProperties = ["Password", "Token", "Secret", "ApiKey", "ConnectionString"];
    options.TrackIpAddress = true;
    options.TrackCorrelationId = true;
    options.AuditLogsTableName = "MesLogsAudit";
    options.EntityChangesTableName = "MesModifications";
});

Tests

Le projet de tests utilise PeasyPilot sous .NET 8 :

  • PeasyPilot.Core pour les assertions fluides.
  • PeasyPilot.Moq pour les mocks.
  • PeasyPilot.XUnit et PeasyPilotTestBase pour l'integration xUnit et le contexte de test.

Les dependances xUnit et Moq sont fournies transitivement par les packages PeasyPilot.

Modèle d'entités

  • AuditLog — un enregistrement d'audit par entité auditable modifiée : UserId, Action (Added/Modified/Deleted), EntityName, Timestamp, IpAddress / CorrelationId optionnels, et une collection de EntityChange.
  • EntityChange — détail au niveau propriété : PropertyName, OldValue, NewValue.

Notes sur ISoftDelete / IAuditableEntity

Ces abstractions sont fournies pour les patterns de soft delete et d'horodatage, mais elles ne sont pas appliquées automatiquement par l'intercepteur. Appliquez-les dans votre propre logique d'entité si nécessaire.

Licence

MIT — Copyright (c) 2026, NID BOUBKER Houssine


Built with ❤️ for the .NET ecosystem.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Hasim.Auditify:

Package Downloads
Hasim.EntityFrameworkCore

A customizable ASP.NET Core Identity entities library providing reusable base identity models and common abstractions for modern .NET applications.

Hasim.Infrastructure

Todo Description.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.6 109 8/30/2026
0.1.5 259 8/1/2026
0.1.4 177 8/1/2026
0.1.3 120 7/30/2026
0.1.2 109 7/30/2026
0.1.1 110 7/30/2026
0.1.0 110 7/30/2026