LumDbEngine 2.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package LumDbEngine --version 2.1.0
                    
NuGet\Install-Package LumDbEngine -Version 2.1.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="LumDbEngine" Version="2.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LumDbEngine" Version="2.1.0" />
                    
Directory.Packages.props
<PackageReference Include="LumDbEngine" />
                    
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 LumDbEngine --version 2.1.0
                    
#r "nuget: LumDbEngine, 2.1.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 LumDbEngine@2.1.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=LumDbEngine&version=2.1.0
                    
Install as a Cake Addin
#tool nuget:?package=LumDbEngine&version=2.1.0
                    
Install as a Cake Tool

LumDb 2.1.0

A single-file, thread-safe embedded database for .NET 10. 100% C#, AOT-friendly, no native dependencies.

On-disk format 1.3.9 (DbHeader.VERSION = 1_003_009). Packed as major * 1_000_000 + minor * 1_000 + patch. Bump that constant when the layout or engine contract changes — there is no runtime “append version” API. DbEngine.Version / VersionString expose the current value ("1.3.9").

Engines

using var mem = new DbEngine();              // in-memory; same instance shares one committed image
using var disk = new DbEngine(@"d:\app.db"); // file + WAL

using (var ts = mem.StartTransaction())
{
    ts.Create<Student>("students");
    ts.Insert("students", new Student { Name = "lj", Age = 20 });
} // Dispose commits. The next StartTransaction on this engine sees the data.

mem.SaveTo(@"d:\app.db");                    // dump committed image (not uncommitted dirty pages)
Memory new DbEngine() File new DbEngine(path)
Persistence Process lifetime Disk + .log WAL
Cross-transaction Same instance shares the committed image Same, via the file
Discard Drops the current tx only Same
Crash recovery N/A Replay .log
SaveTo(path) Full committed dump File copy of committed image

SaveChanges / Dispose commit. Discard rolls back the current transaction and reloads from the committed image. A following Dispose does not overwrite the image with an empty cache.

LumEntity (source generator)

Mark a partial class. Build generates ILumEntity<T> (works without PublishAOT — generation is compile-time).

using LumDbEngine;
using LumDbEngine.Element.Engine;
using LumDbEngine.Element.Engine.Transaction;
using LumDbEngine.Element.Structure;

[LumEntity]
public partial class Student
{
    [Id] public uint Id { get; set; }          // engine auto row id, not a column
    [Key] [Str32B] public string Name { get; set; } = "";
    public int Age { get; set; }
}

const string Table = "students";

using var eng = new DbEngine("demo.db");
using (var ts = eng.StartTransaction())
{
    ts.Create<Student>(Table);
    ts.Insert(Table, new Student { Name = "lj99", Age = 99 });
    ts.Insert(Table, new Student { Name = "lj0", Age = 0 });
}

using (var ts = eng.StartTransaction())
{
    var byKey = ts.FindEntity<Student>(Table, "Name", "lj99");
    Console.WriteLine($"{byKey.Value.Id}, {byKey.Value.Name}, {byKey.Value.Age}");

    ts.GoThrough(Table, (ref RowView row) =>
    {
        if (row.GetInt(1) > 90)
            Console.WriteLine(row.GetString(0));
        return true; // continue
    });
}

Tuple / DbCell API (no entity type):

ts.Create("kv", [("k", DbValueType.Int, true), ("v", DbValueType.StrVar, false)]);
ts.Insert("kv", [("k", 1), ("v", "hello")]);
var row = ts.Find("kv", "k", 1);
Console.WriteLine(row.Row.GetString(1));
ts.Update("kv", 1u, "v", "world");   // by engine row id
ts.Delete("kv", "k", 1);

Unsupported nested members on [LumEntity] are skipped with warning LUMDB002. [Ignore] is silent. DateTime columns are UTC (DateTimeKind.Utc).

Features

  • Relational tables with optional multi-key secondary indexes
  • Types: bool, byte, int/uint, long/ulong, float/double, decimal, DateTime UTC, fixed/var string, fixed/var bytes
  • Read-committed: a readonly transaction sees the last commit, not another writer’s dirty pages
  • Thread-safe: one writer (upgradeable) + concurrent readers
  • Source-generated entities; GoThrough / RowView scan without allocating entities
  • AOT publish supported (PublishAot); daily dotnet build still runs the generator
  • Tools: LumDbExplorer (WinForms) to create/copy databases, create tables, CRUD rows, inspect schema and stats

Getting started

  1. Reference LumDbEngine (net10). For [LumEntity], the analyzer is packed with the NuGet.
  2. new DbEngine() or new DbEngine(path).
  3. using var ts = engine.StartTransaction(); — dispose to commit, or Discard().

License

MIT. See LICENSE.txt.

Product Compatible and additional computed target framework versions.
.NET 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.
  • net10.0

    • No dependencies.

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
2.2.3 97 9/12/2026
2.2.2 110 9/3/2026
2.2.1 94 9/3/2026
2.2.0 93 8/27/2026
2.1.0 111 8/26/2026
1.3.8 143 7/1/2026
1.3.6 252 11/6/2025
1.3.5 222 10/30/2025
1.3.4 200 9/28/2025
1.3.1.1 217 7/17/2025
1.3.1 210 7/17/2025
1.2.1 211 7/8/2025
1.1.4 279 3/7/2025
1.1.2 200 1/26/2025
1.1.1 170 1/22/2025
1.0.6 159 1/14/2025
1.0.5 167 1/13/2025
1.0.1 183 11/21/2024
1.0.0 168 11/16/2024

2.1.0: shared in-memory DbEngine across transactions, SaveTo dump, LumEntity source generator.