Skip to content

TriCoreDB for .NET

0.1.0

The official C# / .NET client: SQL, documents, cache, vectors and graphs over one native connection.

Install

dotnet
dotnet add package TriCoreDb

Requirements

  • .NET 8.0 or later
  • A TriCoreDB server, 0.1.0-rc.1 or later (install one)

Highlights

  • Base class library only
  • Async API with CancellationToken
  • Transactions, connection pool, TLS and mutual TLS

Quick start

Program.cs
using System.Text;
using TriCoreDb;

await using var db = await TriCoreClient.ConnectAsync("127.0.0.1", 8427, "admin", "your-password");

await db.ExecuteAsync("CREATE TABLE IF NOT EXISTS users (id INT PRIMARY KEY, name TEXT)");
await db.ExecuteAsync("INSERT INTO users VALUES (?, ?)", new object?[] { 1, "ada" });

Rows rows = await db.QueryAsync("SELECT id, name FROM users WHERE id = ?", new object?[] { 1 });
Console.WriteLine($"{rows.Columns[1]} = {rows[0][1]}");

await db.CacheSetAsync("app", "greeting", Encoding.UTF8.GetBytes("world"));
string? hello = await db.CacheGetTextAsync("app", "greeting");

TLS

This example connects without TLS, which matches the development container. The default image requires TLS. The README shows how to connect with a CA certificate, and documents every call.