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
                    
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="Naccatech.EntityFramework.Historian.Data" Version="7.0.2026011.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Naccatech.EntityFramework.Historian.Data" Version="7.0.2026011.2" />
                    
Directory.Packages.props
<PackageReference Include="Naccatech.EntityFramework.Historian.Data" />
                    
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 Naccatech.EntityFramework.Historian.Data --version 7.0.2026011.2
                    
#r "nuget: Naccatech.EntityFramework.Historian.Data, 7.0.2026011.2"
                    
#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 Naccatech.EntityFramework.Historian.Data@7.0.2026011.2
                    
#: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=Naccatech.EntityFramework.Historian.Data&version=7.0.2026011.2
                    
Install as a Cake Addin
#tool nuget:?package=Naccatech.EntityFramework.Historian.Data&version=7.0.2026011.2
                    
Install as a Cake Tool

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:

  1. Download both the Naccatech.EntityFramework.Historian.Data and Naccatech.EntityFramework.Historian.Entities nuget packages.

  2. Create a DbContext by adding a using statement for Naccatech.EntityFramework.Historian.Data and inheriting from the HistorianDbContext.

  3. Perform the normal EF setup in your inherited DbContext: ConnectionStrings, DbSets, Entity Configurations...

  4. Register the entities that you want tracked in the OnModelCreating override:

    1. Get your DbContext HistoryTracker instance by overriding OnModelCreating(...):

      protected override void OnModelCreating(ModelBuilder modelBuilder, HistoryTracker historyTracker)
      {
          // regular EF model configurations
      }
      
    2. Track an entity by calling historyTracker.Register<...>(schema):

      protected override void OnModelCreating(ModelBuilder modelBuilder, HistoryTracker historyTracker)
      {
          ...
          historyTracker.Register<MyFirstEntity>(null);
          historyTracker.Register<MySecondEntity>(null);
      }
      
    3. 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));
      }
      
    4. 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);
      }
      
  5. 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);
    
  6. 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 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. 
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
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
Loading failed

Updated to .NET 7 latest