SimpleTextDatabase 1.10.2

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

SimpleTextDatabase

A simple text-based database with basic ORM functionality for .NET 8 / 9 / 10. One file on disk, tables and rows are line-based, with sync and async APIs, transactions, and DI integration.

NuGet

Install

dotnet add package SimpleTextDatabase

Quick start

using WordDataBase;

using var db = new TextDatabase("data.txt");

db.CreateTable("users", new[]
{
    new Column("Id",     DataType.Int),
    new Column("Name",   DataType.String),
    new Column("Active", DataType.Bool),
});

db.InsertData("users", new[] { "1", "Alice", "true" });
db.InsertData("users", new[] { "2", "Bob",   "false" });

var rows = db.Select("users",
    columns: new[] { "Name" },
    filter:  r => r[0] != "Bob",
    orderByColumn: "Name");
// => [ ["Alice"] ]

Async API

Every operation has an async sibling that uses File.ReadAllLinesAsync / WriteAllLinesAsync:

await db.CreateTableAsync("users", schema, cancellationToken);
await db.InsertDataAsync("users", row, cancellationToken);
var rows = await db.SelectAsync("users", cancellationToken: cancellationToken);

Sync and async paths share a single SemaphoreSlim gate, so mixing them is safe.

Dependency injection

using Microsoft.Extensions.DependencyInjection;
using WordDataBase;

var services = new ServiceCollection();
services.AddSimpleTextDatabase(opts => opts.FilePath = "data.txt");
// or
services.AddSimpleTextDatabase("data.txt");

using var sp = services.BuildServiceProvider();
var db = sp.GetRequiredService<IDatabase>();

IDatabase is registered as a singleton.

Transactions

db.BeginTransaction();
try
{
    db.InsertData("users", new[] { "3", "Carol", "true" });
    db.CommitTransaction();
}
catch
{
    db.RollbackTransaction();
    throw;
}
  • Only one transaction is active at a time.
  • Commit and Rollback clean up the temp file in finally, so a crash mid-commit doesn't leak it permanently.
  • DropDatabase aborts any active transaction and recreates an empty file.

Supported column types

DataType Stored as
Int invariant decimal int
String UTF-8 text
Bool invariant true/false

Values are parsed and re-serialized with CultureInfo.InvariantCulture so files round-trip across locales.

Build & test

dotnet build WordDataBase.sln
dotnet test  WordDataBase.sln

Release

Bump <Version> in src/WordDataBase/WordDataBase.csproj, commit, push to product. CI builds, packs, and publishes to nuget.org automatically (--skip-duplicate).

License

MIT — see LICENSE.txt.

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
1.10.2 93 5/11/2026
1.9.1 195 1/26/2025
1.0.0 229 8/17/2024

v1.10.2: CI/CD triggers on `product` branch instead of `main`.
v1.10.1: Updated package icon; gitignore Claude Code artifacts.
v1.10.0: Major refactor. Added net10.0 target, async API, DI extensions, fixed transaction bugs, unified namespace, restructured into src/ layout. See CHANGELOG.md.