Embedded .NET Document-Relational Database

A lightweight database combining NoSQL flexibility with SQL reliability.
Built on SQLite. Powered by LINQ. Zero configuration.

SoloDB 1.4.2. Full-text search with ranked results, and databases kept in your own streams or files. One database for documents, relations and files. Try full-text search → Release notes →

Quick Start

dotnet add package SoloDB
using System.Linq;
using SoloDatabase;

using var db = new SoloDB("memory:quickstart");
var users = db.GetCollection<User>();

// Insert
users.Insert(new User { Name = "Alice", Email = "alice@example.com" });

// Query with LINQ
var found = users.FirstOrDefault(u => u.Email == "alice@example.com");
if (found != null)
{
    // Update
    found.Name = "Alice Smith";
    users.Update(found);

    // Delete
    users.Delete(found.Id);
}

public class User
{
    public long Id { get; set; }
    public string Name { get; set; } = "";
    public string Email { get; set; } = "";
}

Features

SQLite Foundation

Built on the world's most deployed database engine. Battle-tested reliability with JSONB support for document storage.

Full LINQ Support

Strongly-typed queries with full IntelliSense. Where, Select, GroupBy, OrderBy, and 40+ more LINQ operations.

ACID Transactions

Full transactional guarantees with automatic rollback on exceptions. Thread-safe with built-in connection pooling.

Integrated File Storage

Hierarchical file system API with metadata support. Upload, download, and manage files directly in your database.

Polymorphic Collections

Store different derived types in a single collection. Query by base type or filter with OfType<T>().

Document-Relational DB

First-class document references with DBRef<T> and DBRefMany<T>. Automatic cascade insert, configurable delete policies, and LINQ-queryable joins.

Full NativeAOT Support

Publish C# and F# applications with generated operations for your models and queries. Follow the NativeAOT setup guide to get started.

Compiled Queries

Translate a query once, then pass fresh arguments each time you run it. Retain a compiled query for repeated searches and pages.

Search stored text with weighted fields, ranked results and highlighted snippets. Combine search with LINQ filters, ordering and pages.

Your Storage, SQLite Transactions

Supply streams or positional byte files while keeping the usual database API. Choose storage and coordination, including a database inside another SoloDB filesystem.

Exact Decimal and BigInteger

Store decimal and BigInteger values exactly, then filter, sort and sum them inside SQLite. See exact numbers.

Direct Typed JSON

Read and write typed values as UTF-8 or UTF-16 without an intermediate JSON tree. Explore the direct JSON APIs.

Indexing Made Simple

using SoloDatabase.Attributes;

public class Product
{
    public long Id { get; set; }

    [Indexed(unique: true)]
    public string SKU { get; set; }

    [Indexed]
    public string Category { get; set; }
}

Powerful Transactions

db.WithTransaction(tx =>
{
    var accounts = tx.GetCollection<Account>();
    var from = accounts.GetById(fromId);
    var to = accounts.GetById(toId);

    from.Balance -= amount;
    to.Balance += amount;

    accounts.Update(from);
    accounts.Update(to);
});

File Storage

var fs = db.FileSystem;

// Upload with metadata
fs.Upload("/reports/q4.pdf", stream);
fs.SetMetadata(
    "/reports/q4.pdf", "Author", "Finance");

// Download
fs.Download("/reports/q4.pdf", outputStream);

Document Relations

public class Order
{
    public long Id { get; set; }
    public DBRef<Customer> Customer { get; set; }
    public DBRefMany<OrderItem> Items { get; set; }
}

// Cascade-insert a new customer with the order
orders.Insert(new Order
{
    Customer = DBRef<Customer>.From(
        new Customer { Name = "Acme" }),
});

Ready to Get Started?

SoloDB is open source under LGPLv3 with a distribution exception for commercial or closed-source applications and independent libraries.