Naccatech.EntityFramework.Historian.Data
7.0.2026011.2
dotnet add package Naccatech.EntityFramework.Historian.Data --version 7.0.2026011.2
NuGet\Install-Package Naccatech.EntityFramework.Historian.Data -Version 7.0.2026011.2
<PackageReference Include="Naccatech.EntityFramework.Historian.Data" Version="7.0.2026011.2" />
<PackageVersion Include="Naccatech.EntityFramework.Historian.Data" Version="7.0.2026011.2" />
<PackageReference Include="Naccatech.EntityFramework.Historian.Data" />
paket add Naccatech.EntityFramework.Historian.Data --version 7.0.2026011.2
#r "nuget: Naccatech.EntityFramework.Historian.Data, 7.0.2026011.2"
#:package Naccatech.EntityFramework.Historian.Data@7.0.2026011.2
#addin nuget:?package=Naccatech.EntityFramework.Historian.Data&version=7.0.2026011.2
#tool nuget:?package=Naccatech.EntityFramework.Historian.Data&version=7.0.2026011.2
Introduction
EF Historian is built on EntityFramework and enables automatic auditing/history of any EF controlled tables. Setup your models in normal EF fashion and register them for history tracking. EF Historian will assign a runtime type matching the model identified and use it to track the changes.
Getting Started
To get started with EF Historian:
Download both the Naccatech.EntityFramework.Historian.Data and Naccatech.EntityFramework.Historian.Entities nuget packages.
Create a DbContext by adding a using statement for Naccatech.EntityFramework.Historian.Data and inheriting from the HistorianDbContext.
Perform the normal EF setup in your inherited DbContext: ConnectionStrings, DbSets, Entity Configurations...
Register the entities that you want tracked in the OnModelCreating override:
Get your DbContext HistoryTracker instance by overriding OnModelCreating(...):
protected override void OnModelCreating(ModelBuilder modelBuilder, HistoryTracker historyTracker) { // regular EF model configurations }Track an entity by calling historyTracker.Register<...>(schema):
protected override void OnModelCreating(ModelBuilder modelBuilder, HistoryTracker historyTracker) { ... historyTracker.Register<MyFirstEntity>(null); historyTracker.Register<MySecondEntity>(null); }If certain properties should not be tracked, excluded them when registering the entity:
protected override void OnModelCreating(ModelBuilder modelBuilder, HistoryTracker historyTracker) { ... historyTracker.Register<MyThirdEntity>(null, nameof(MyThirdEntity.FirstUntrackedProperty)); historyTracker.Register<MyFourthEntity>(null, nameof(MyFourthEntity.FirstUntrackedProperty), nameof(MyFourthEntity.SecondUntrackedProperty)); }All changes to any registered entities will be added to a history table for that entity in the desired schema (or default schema if null):
protected override void OnModelCreating(ModelBuilder modelBuilder, HistoryTracker historyTracker) { ... var historySchema = "dbo.audit"; historyTracker.Register<MyFifthEntity>(historySchema); }
Historical records are accessible from the DbContext by calling the generic method this.HistoricalSet<T>() with the registered model type:
// IQueryable sets are returned with untracked entities (readonly) var oneDayAgo = DateTime.Now.Subtract(TimeSpan.FromHours(24)); var recentChanges = context .HistoricalSet<MyFirstEntity>() .Where(x => x.__ChangedOn > oneDayAgo);Historical records have the following properties in addition to all the tracked entity properties:
public Guid __Id; // unique key to each entry public string __ChangeType; // the EntityFramework change type: Added, Modified, Deleted public string __ChangedFields; // the field names that changed (null for Added and Deleted) public DateTime __ChangedOn; // the UTC timestamp of the change
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net7.0 is compatible. 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. 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. |
-
net7.0
- Microsoft.Data.SqlClient (>= 5.2.2)
- Microsoft.EntityFrameworkCore (>= 7.0.20)
- Microsoft.EntityFrameworkCore.SqlServer (>= 7.0.20)
- Microsoft.IdentityModel.JsonWebTokens (>= 7.7.1)
- Naccatech.EntityFramework.Historian.Entities (>= 7.0.2026011.2)
- System.IdentityModel.Tokens.Jwt (>= 7.7.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 |
|---|---|---|
| 7.0.2026011.2 | 134 | 1/12/2026 |
| 6.0.2024329.2 | 217 | 11/25/2024 |
| 5.0.2022276.1 | 550 | 10/3/2022 |
| 3.0.2023022.1 | 408 | 1/23/2023 |
| 2.0.2022285.1 | 519 | 10/12/2022 |
| 1.0.2022285.1 | 557 | 10/12/2022 |
Updated to .NET 7 latest