Skip to content

Quick Start

Tom Laird-McConnell edited this page May 24, 2026 · 1 revision

Quick Start

Get from zero to search in under two minutes.

Install

dotnet add package LottaDB

Define a class

No attributes needed. Any plain C# class works:

public class Actor
{
    public string Username { get; set; } = "";
    public string DisplayName { get; set; } = "";
    public int FollowerCount { get; set; }
}

All simple-type properties (string, int, bool, DateTime, etc.) are automatically indexed and queryable.

Create a catalog and database

For production with Azure:

// Connection string constructor -- sets up Azure Table + Blob Storage automatically
var catalog = new LottaCatalog("myapp", connectionString);

// Get a database within the catalog
var db = await catalog.GetDatabaseAsync("social");

To get started quickly without Azure, install LottaDB.Memory and use the in-memory provider:

dotnet add package LottaDB.Memory
// In-memory provider -- no Azure account needed, great for trying things out
var catalog = new LottaCatalog("myapp", catalog => catalog.UseMemory());

var db = await catalog.GetDatabaseAsync("social");

See Configuration for all available storage providers (UseAzure, UseFileSystem, UseSQLite).

Save an object

await db.SaveAsync(new Actor
{
    Username = "alice",
    DisplayName = "Alice",
    FollowerCount = 42
});

No [Key] attribute? LottaDB auto-generates a ULID key. To retrieve the generated key:

var actor = new Actor { Username = "alice", DisplayName = "Alice" };
await db.SaveAsync(actor);
var key = actor.GetKey();  // auto-generated ULID like "01HX..."

Read it back

var actor = await db.GetAsync<Actor>(key);

Search

// LINQ on indexed properties
var results = db.Search<Actor>()
    .Where(a => a.DisplayName == "Alice")
    .ToList();

// Full-text search
var found = db.Search<Actor>("alice").ToList();

Delete

await db.DeleteAsync<Actor>(key);

What's next

Want to control which properties are indexed, set custom keys, or configure exact-match vs. full-text search? See Storing POCOs.

Clone this wiki locally