DataLineage.Tracking 1.0.46

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

DataLineage.Tracking

Overview

DataLineage.Tracking is a powerful and extensible data lineage tracking library for .NET. It allows structured tracking of data transformations across various mapping solutions, including AutoMapper, Mapster, custom mappers, or any other mapping strategy.

Features 🚀

Generic & Flexible – Works with any mapping framework or custom implementations
Tracks Data Transformations – Captures how data flows from source to target
Dependency Injection (DI) Ready – Easily integrates into .NET applications
Extensible Sink System – Store lineage data in memory, JSON files, databases, etc.
Asynchronous Support – Efficient non-blocking lineage storage

Installation 📦

To install DataLineage.Tracking, run:

dotnet add package DataLineage.Tracking

Getting Started 🛠️

1️⃣ Setting Up Dependency Injection

Register DataLineage.Tracking in your .NET DI container:

using Microsoft.Extensions.DependencyInjection;
using DataLineage.Tracking;
using DataLineage.Tracking.Sinks;

// Configure DI
var serviceProvider = new ServiceCollection()
    .AddDataLineageTracking(typeof(Program).Assembly, sinks: new FileLineageSink("lineage.json"))
    .BuildServiceProvider();

// Resolve lineage tracker
var lineageTracker = serviceProvider.GetRequiredService<IDataLineageTracker>();

2️⃣ Tracking Data Transformations

Use the lineage tracker to monitor how data moves from a source field to a target field:

lineageTracker.Track(
    sourceName: "OrderSystem",
    sourceEntity: "Order",
    sourceField: "TotalPrice",
    sourceValidated: true,
    sourceDescription: "The total price of an order",
    transformationRule: "Converted from decimal to string",
    targetName: "ReportingDB",
    targetEntity: "FinancialReport",
    targetField: "OrderTotal",
    targetValidated: true,
    targetDescription: "The order total in reporting currency"
);

3️⃣ Using a Generic Mapper with Lineage

You can implement a trackable entity mapper to automate lineage tracking:

using DataLineage.Tracking.Mapping;
using DataLineage.Tracking.Interfaces;

public class OrderToReportMapper : TrackableEntityMapper<Order, FinancialReport>
{
    public OrderToReportMapper(IDataLineageTracker tracker) : base(tracker) {}

    public override FinancialReport Map(Order order)
    {
        var report = new FinancialReport
        {
            OrderId = order.Id,
            OrderTotal = order.TotalPrice.ToString("F2")
        };

        _lineageTracker.Track(
            "OrderSystem", nameof(Order), nameof(Order.TotalPrice), true, "Order price",
            "Converted to string",
            "ReportingDB", nameof(FinancialReport), nameof(FinancialReport.OrderTotal), true, "Formatted order total"
        );

        return report;
    }
}

4️⃣ Using Lineage Sinks (File, Database, etc.)

By default, lineage data is stored in memory, but you can store it in JSON files or a relational database.

📂 File-based Storage
var fileSink = new FileLineageSink("lineage.json", deleteOnStartup: true);
var lineageTracker = new DataLineageTracker(fileSink);
🗄️ Database Storage (SQL)
using System.Data.SqlClient;
using DataLineage.Tracking.Sinks;

// Configure a database lineage sink
var sqlSink = new SqlLineageSink(() => new SqlConnection("Your_Connection_String"));

// Register in DI
var serviceProvider = new ServiceCollection()
    .AddDataLineageTracking(typeof(Program).Assembly, sinks: sqlSink)
    .BuildServiceProvider();

5️⃣ Retrieving Lineage History

var history = lineageTracker.GetLineage();
foreach (var entry in history)
{
    Console.WriteLine(entry);
}

Advanced Features

Multiple Sinks

You can configure multiple lineage sinks at once, for example, storing lineage in both a file and a database:

var fileSink = new FileLineageSink("lineage.json");
var sqlSink = new SqlLineageSink(() => new SqlConnection("Your_Connection_String"));

var serviceProvider = new ServiceCollection()
    .AddDataLineageTracking(typeof(Program).Assembly, sinks: fileSink, sqlSink)
    .BuildServiceProvider();

Asynchronous Storage

All lineage operations support async storage, ensuring efficiency in high-performance applications.


Contributing

Contributions are welcome! If you find a bug, want a feature, or have an idea, feel free to open an issue or pull request on GitHub.

License

This project is licensed under the MIT License.

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

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.46 481 3/26/2025
1.0.44 156 3/12/2025
1.0.42 146 3/12/2025
1.0.40 175 3/10/2025
1.0.38 179 3/10/2025
1.0.36 178 3/10/2025
1.0.34 219 3/4/2025
1.0.32 215 3/4/2025
1.0.30 210 3/4/2025
1.0.28 214 3/4/2025
1.0.26 207 3/4/2025
1.0.24 211 3/4/2025
1.0.22 201 3/4/2025
1.0.20 202 3/4/2025
1.0.18 189 3/3/2025
1.0.16 115 3/3/2025
1.0.14 120 3/3/2025
1.0.12 103 3/2/2025
1.0.10 104 3/2/2025
1.0.8 101 3/2/2025