DataLinq.Tools 0.7.0

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

DataLinq

Latest CI Full Matrix Nightly Full matrix tests Docs NuGet DataLinq.SQLite NuGet DataLinq.MySql NuGet DataLinq.CLI License: MIT .NET 8, 9, 10 Supported targets

Documentation website | Getting started | Changelog

DataLinq is an immutable-first, source-generated ORM for .NET. It is built for applications where repeated reads, relation traversal, predictable object state, and cache behavior matter more than having an ORM translate every possible LINQ expression.

The short version: DataLinq moves work into generation and metadata so the runtime can do less guessing.

Why DataLinq Exists

Most ORMs optimize for convenience first. That is useful, but it often means mutable tracked entities, runtime mapping, hidden query behavior, and late surprises.

DataLinq makes a narrower trade:

  • Generated model surface: source generators create the concrete immutable and mutable types.
  • Immutable reads: query results are stable objects, not ambient mutable state.
  • Explicit writes: updates go through mutable wrappers and transactions instead of hidden dirty tracking.
  • Cache-aware relations: repeated primary-key reads and relation traversal can reuse cached rows.
  • Honest LINQ support: documented query shapes are backed by tests; unsupported shapes should fail clearly.
  • Schema trust tooling: validate and diff compare generated model metadata against live provider metadata without pretending to be full migrations.

It is currently focused on SQLite, MySQL, and MariaDB for .NET 8, .NET 9, and .NET 10.

When It Fits

DataLinq is a strong fit for read-heavy applications, small-to-medium relational databases, generated model workflows, and systems where explicit mutation boundaries are a feature rather than a nuisance.

It is not trying to be a universal EF replacement, a full migration engine, or a provider that translates arbitrary LINQ. That restraint is intentional.


Getting Started

Installation

Install the provider package that matches your runtime database:

# MySQL and MariaDB
dotnet add package DataLinq.MySql

# SQLite
dotnet add package DataLinq.SQLite

The CLI is installed as a dotnet tool named datalinq:

dotnet tool install --global DataLinq.CLI

Current package and repo builds target .NET 8, .NET 9, and .NET 10.

Configuration

The CLI reads datalinq.json and, if present next to it, datalinq.user.json.

Minimal example:

{
  "Databases": [
    {
      "Name": "AppDb",
      "CsType": "AppDb",
      "Namespace": "MyApp.Models",
      "ModelDirectory": "Models",
      "Connections": [
        {
          "Type": "MariaDB",
          "DataSourceName": "appdb",
          "ConnectionString": "Server=localhost;Database=appdb;User ID=app;Password=secret;"
        }
      ]
    }
  ]
}

Generate your data models directly from your database schema:

datalinq create-models -n AppDb

Generated C# files are marked as DataLinq-generated and declare their nullable context. Nullable reference generation is enabled by default; set "UseNullableReferenceTypes": false in the database config to opt out.

Validate your configured models against the live database:

datalinq validate -n AppDb

validate exits with 0 when no drift is found, 1 when schema drift is detected, and 2 for command, configuration, metadata, or validation issues. Use --output json when wiring the result into automation; JSON output includes structured validation issues as well as drift differences.

Generate a conservative SQL suggestion script for supported additive drift:

datalinq diff -n AppDb -o update_schema.sql

diff is read-only. It comments destructive, ambiguous, or unsupported changes instead of applying them. If validation issues exist, diff reports them and writes no SQL file.

If your config contains more than one database, pass -n. If the selected database contains more than one connection type, pass -t.


Code Example

using DataLinq;
using DataLinq.MySql;
using MyApp.Models;

var db = new MySqlDatabase<AppDb>(connectionString);

var activeUsers = db.Query().Users
    .Where(x => x.IsActive)
    .ToList();

var user = db.Query().Users.Single(x => x.UserId == userId);
var updatedUser = user.Mutate(x => x.DisplayName = "Updated Name").Save();

Documentation

If you want the website-first docs experience, start here:

After that, the deeper working docs are:

License

DataLinq is open source and distributed under the MIT License. See the LICENSE file for more details.

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 is compatible.  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 is compatible.  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
0.7.0 87 5/18/2026
0.6.9 94 4/29/2026
0.6.8 90 4/17/2026
0.6.7 100 3/30/2026
0.6.6 301 12/18/2025
0.6.5 300 11/12/2025
0.6.4 262 8/27/2025
0.6.3 210 8/17/2025
0.6.2 202 8/17/2025
0.6.1 312 8/5/2025
0.6.0 169 7/29/2025
0.5.4 357 6/11/2025
0.5.3 225 6/4/2025
0.5.2 220 5/19/2025
0.5.1 219 4/11/2025
0.5.0 255 4/3/2025
0.4.15 226 5/16/2024
0.4.14 244 2/7/2024
0.4.13 207 1/30/2024
0.4.11 262 12/4/2023
Loading failed