CSharpDB.Engine
1.3.0
Prefix Reserved
See the version list below for details.
dotnet add package CSharpDB.Engine --version 1.3.0
NuGet\Install-Package CSharpDB.Engine -Version 1.3.0
<PackageReference Include="CSharpDB.Engine" Version="1.3.0" />
<PackageVersion Include="CSharpDB.Engine" Version="1.3.0" />
<PackageReference Include="CSharpDB.Engine" />
paket add CSharpDB.Engine --version 1.3.0
#r "nuget: CSharpDB.Engine, 1.3.0"
#:package CSharpDB.Engine@1.3.0
#addin nuget:?package=CSharpDB.Engine&version=1.3.0
#tool nuget:?package=CSharpDB.Engine&version=1.3.0
CSharpDB.Engine
Lightweight embedded SQL database engine for .NET with single-file storage, WAL durability, concurrent readers, and a typed Collection<T> NoSQL API.
Overview
CSharpDB.Engine is the main entry point for embedding CSharpDB in your .NET application. It combines the SQL parser, query planner, and B+tree storage engine into a single Database class with two access paths: a full SQL engine and a zero-SQL Collection<T> document API. No external dependencies, no server process, just a single .db file on disk.
Features
- SQL engine: DDL, DML, JOINs, aggregates, GROUP BY, HAVING, CTEs, views, triggers, indexes
- NoSQL Collection API: Typed
Collection<T>withPut/Get/Delete/Scan/Find - Single-file storage: All data in one
.dbfile with 4 KB B+tree pages - WAL durability: Write-ahead log with crash recovery
- Concurrent readers: Snapshot-isolated readers alongside a single writer
- Statement cache: LRU cache (512 capacity) for parsed and planned queries
- Fast-path lookups: Direct B+tree access for
SELECT ... WHERE pk = value - Async-first: All APIs are
async/awaitfrom top to bottom
Usage
SQL API
using CSharpDB.Engine;
// Open or create a database
await using var db = await Database.OpenAsync("myapp.db");
// Create a table
await db.ExecuteAsync("""
CREATE TABLE users (
id INTEGER PRIMARY KEY,
name TEXT,
email TEXT
)
""");
// Insert data
await db.ExecuteAsync("INSERT INTO users VALUES (1, 'Alice', 'alice@example.com')");
// Query data
var result = await db.ExecuteAsync("SELECT name, email FROM users WHERE id = 1");
while (await result.MoveNextAsync())
{
Console.WriteLine($"{result.Current[0].AsText} - {result.Current[1].AsText}");
}
// Transactions
await db.BeginTransactionAsync();
await db.ExecuteAsync("INSERT INTO users VALUES (2, 'Bob', 'bob@example.com')");
await db.CommitAsync();
NoSQL Collection API
// Get a typed collection
var users = await db.GetCollectionAsync<User>("users");
// Put a document
await users.PutAsync("alice", new User { Name = "Alice", Age = 30 });
// Get a document
var alice = await users.GetAsync("alice");
// Scan all documents
await foreach (var user in users.ScanAsync())
{
Console.WriteLine(user.Name);
}
// Find with predicate
var adults = await users.FindAsync(u => u.Age >= 18);
Concurrent Readers
// Create a snapshot-isolated reader session
using var reader = db.CreateReaderSession();
var result = await reader.ExecuteAsync("SELECT * FROM users");
// Reads from a consistent snapshot while the writer continues
Installation
dotnet add package CSharpDB.Engine
For the recommended all-in-one package:
dotnet add package CSharpDB
Dependencies
CSharpDB.Primitives- shared type systemCSharpDB.Sql- SQL parserCSharpDB.Storage- B+tree storage engineCSharpDB.Execution- query planner and operators
Related Packages
| Package | Description |
|---|---|
| CSharpDB.Data | ADO.NET provider built on this engine |
| CSharpDB.Service | Thread-safe service layer for web apps |
| CSharpDB.Storage.Diagnostics | Storage inspection and integrity checking |
License
MIT - see LICENSE for details.
| Product | Versions 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. |
-
net10.0
- CSharpDB.Execution (>= 1.3.0)
- CSharpDB.Primitives (>= 1.3.0)
- CSharpDB.Sql (>= 1.3.0)
- CSharpDB.Storage (>= 1.3.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on CSharpDB.Engine:
| Package | Downloads |
|---|---|
|
CSharpDB.Data
ADO.NET provider for CSharpDB. Standard DbConnection, DbCommand, and DbDataReader with parameterized queries and transactions. |
|
|
CSharpDB.Client
Unified CSharpDB client SDK with pluggable transports (Direct, HTTP, gRPC, TCP, Named Pipes). |
|
|
CSharpDB
All-in-one package for CSharpDB application development. Includes the unified client, engine, ADO.NET provider, and diagnostics. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.0 | 91 | 4/8/2026 |
| 2.9.1 | 109 | 4/7/2026 |
| 2.8.1 | 106 | 4/6/2026 |
| 2.8.0 | 97 | 4/4/2026 |
| 2.7.0 | 98 | 3/31/2026 |
| 2.6.0 | 100 | 3/29/2026 |
| 2.5.0 | 202 | 3/28/2026 |
| 2.4.0 | 100 | 3/24/2026 |
| 2.3.0 | 99 | 3/22/2026 |
| 2.2.0 | 94 | 3/21/2026 |
| 2.0.1 | 114 | 3/14/2026 |
| 2.0.0 | 97 | 3/13/2026 |
| 1.9.0 | 119 | 3/12/2026 |
| 1.8.0 | 118 | 3/11/2026 |
| 1.7.0 | 118 | 3/8/2026 |
| 1.6.0 | 105 | 3/8/2026 |
| 1.5.0 | 107 | 3/7/2026 |
| 1.4.0 | 106 | 3/7/2026 |
| 1.3.0 | 106 | 3/6/2026 |
| 1.2.0 | 106 | 3/5/2026 |