Drasi 0.1.0

dotnet add package Drasi --version 0.1.0
                    
NuGet\Install-Package Drasi -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Drasi" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Drasi" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Drasi" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Drasi --version 0.1.0
                    
#r "nuget: Drasi, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Drasi@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Drasi&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Drasi&version=0.1.0
                    
Install as a Cake Tool

drasi-dotnet

Embed the Drasi continuous-query engine in .NET.

A Rust cdylib hosts drasi-lib behind a small C ABI. C# binds it with [LibraryImport] and wraps it in an idiomatic façade (IAsyncDisposable, IAsyncEnumerable, typed errors). See docs/api-reference.md for the public API.

Requirements

  • Rust stable (see rust-toolchain.toml) to build the native library
  • .NET 8+ to consume it (net8.0 LTS is the API floor)

Consumers of the NuGet package do not need a Rust toolchain. Prebuilt binaries ship for win-x64, linux-x64, linux-arm64, osx-x64, and osx-arm64.

Build native + run the sample

From the repo root:

cargo build --release --manifest-path native/Cargo.toml
dotnet run --project examples/Quickstart

Or:

./scripts/run-quickstart.sh

Download plugins from ghcr.io and use them as a source and a reaction (needs network):

dotnet run --project examples/Plugins

Generic host + DI — configure Drasi at startup; the host starts it, applies the topology, and stops it:

dotnet run --project examples/Hosted

The sample copies libdrasi_ffi.dylib / .so / drasi_ffi.dll next to the app. The C# library also resolves the dylib from native/target/{release,debug} so a plain dotnet run works after a cargo build.

Expected output looks like:

  Add {"id":"o1","total":42}
open orders: [{"id":"o1","total":42}]

Both samples pass an ILoggerFactory (console). Quickstart logs at Warning; the plugins sample uses Information so reaction/log output shows up. Native logs no longer need RUST_LOG when a factory is set.

Quickstart shape

using var logs = LoggerFactory.Create(builder => builder.AddSimpleConsole());
await using var drasi = await Engine.CreateAsync("dotnet-demo", new EngineOptions
{
    LoggerFactory = logs,
});
await drasi.StartAsync();
await drasi.AddSourceAsync("orders");
await drasi.AddQueryAsync(
    "open",
    "MATCH (o:Order) WHERE o.status = 'open' RETURN o.id AS id, o.total AS total",
    ["orders"]);
await drasi.WaitForQueryAsync("open");
await foreach (var evt in drasi.QueryResultsAsync("open"))
{
    foreach (var diff in evt.Results)
        Console.WriteLine($"{diff.Type} {diff.Data}");
}

await drasi.PushChangeAsync("orders", new SourceChange
{
    Op = ChangeOp.Insert,
    Id = "o1",
    Labels = ["Order"],
    Properties = new JsonObject { ["id"] = "o1", ["status"] = "open", ["total"] = 42 },
});

DrasiVersion exposes Core / Lib / Sdk / Package. ShutdownAsync releases native stores (including the RocksDB lock) before dispose.

Hosted apps declare the topology in AddDrasi; no extra IHostedService is required:

builder.Services.AddDrasi("orders-app", drasi =>
{
    drasi.AddSource("orders");
    drasi.AddQuery("open",
        "MATCH (o:Order) WHERE o.status = 'open' RETURN o.id AS id, o.total AS total",
        ["orders"]);
    drasi.AddReaction("watch", ["open"], evt =>
    {
        foreach (var diff in evt.Results)
            Console.WriteLine($"{diff.Type} {diff.Data}");
    });
});
await builder.Build().RunAsync();

Push into Engine from the rest of the app (GetRequiredService<Engine>()), or Seed changes that should fire at startup.

Errors expose a stable Code (DrasiErrorCodes). Catch DrasiException or a more specific type (UnknownKindException, SourceException, …).

Pack (local RID)

./scripts/pack.sh osx-arm64   # or win-x64, linux-x64, linux-arm64, osx-x64

CI builds every declared RID and verifies the nupkg loads without Rust. Tagged releases (vMAJOR.MINOR.PATCH) publish to nuget.org. See docs/releasing.md.

Layout

native/                 Rust cdylib (C ABI)
src/Drasi/              C# library
examples/Quickstart/    Console sample
examples/Plugins/       Install source/mock + reaction/log from ghcr.io
examples/Hosted/        Generic host; configure topology in AddDrasi
tests/Drasi.Tests/      Public API tests
docs/api-reference.md   API surface + gap audit

License

Apache-2.0. See LICENSE.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 103 9/4/2026