Skip to content
Tom Laird-McConnell edited this page May 24, 2026 · 5 revisions
icon

LottaDB

LottaDB is a .NET library that makes it easy to store any object in Azure Table Storage with full Lucene search, all with the goodness of LINQ.

Why LottaDB?

  • A lotta bang for a little buck. Table Storage is the cheapest durable storage in Azure. LottaDB adds Lucene so you get rich queries without the rich pricing.
  • A lotta power, without a lotta work. Store any POCO/JSON objects with no configuration. AutoQueryable indexes every simple-type property automatically, identifying key by convention.
  • A lotta LINQ. GetManyAsync<T>() and Search<T>(), .Where(), .OrderBy() etc.
  • A lotta fidelity. Full object roundtrip. Lists, dictionaries, nested objects -- everything survives.
  • A lotta views. On<T> triggers build materialized views with plain C#. No event buses, no eventual consistency -- just inline code.
  • A lotta tenants. One catalog per tenant with multiple databases. Natural isolation, simple cleanup -- delete the catalog and everything goes with it.
  • A lotta nothing to operate. Table Storage is serverless. Lucene runs in-process. No clusters, no connection pools, no ops team required.
  • A lotta schema safety. Schema changes are detected automatically -- when your type registrations change, the Lucene index is rebuilt on startup.

Sweet spot

LottaDB is ideal for per-user or per-tenant workloads -- think user profiles, settings, activity feeds, personal knowledge bases, mailboxes, or per-project data. Thousands of objects per tenant, thousands of tenants per deployment. Each tenant gets its own isolated catalog for pennies/month. It's not designed for billion-row analytics or high-throughput write-heavy pipelines.

Installation

dotnet add package LottaDB

Storage Providers

LottaDB ships as a core package plus separate provider packages. Install only what you need:

Package Method Description
LottaDB UseAzure(connectionString) Azure Table + Blob Storage (production). Built into the core package.
LottaDB.Memory UseMemory() In-memory storage. Fast, no dependencies. Ideal for unit tests.
LottaDB.FileSystem UseFileSystem(rootPath) File-based storage on disk. Good for local dev and debugging.
LottaDB.SQLite UseSQLite(rootPath) SQLite-backed storage. Single-file persistence for local dev.

Quick Example

Any C# class works out of the box -- no attributes required. AutoQueryable (on by default) indexes all simple-type properties automatically. A ULID key is generated if no [Key] property exists.

public class Actor
{
    public string Id { get; set; } = "";
    public string DisplayName { get; set; } = "";
}

// Create a catalog with a connection string (Azure production)
var catalog = new LottaCatalog("myapp", connectionString);

// Create a database "Actors"
var db = await catalog.GetDatabaseAsync("Actors");

// save an Actor into it.
await db.SaveAsync(new Actor { Id = "alice", DisplayName = "Alice Buttercup" });

// get an object back out
var actor = await db.GetAsync<Actor>("alice");

// search for an object
var found = db.Search<Actor>().Where(a => a.DisplayName == "Alice Buttercup").ToList();

await db.DeleteAsync("alice");

Documentation

Getting Started

Storing Data

Querying Data

Advanced

Clone this wiki locally