Dali 0.0.7-alpha

This is a prerelease version of Dali.
dotnet add package Dali --version 0.0.7-alpha
                    
NuGet\Install-Package Dali -Version 0.0.7-alpha
                    
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="Dali" Version="0.0.7-alpha" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Dali" Version="0.0.7-alpha" />
                    
Directory.Packages.props
<PackageReference Include="Dali" />
                    
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 Dali --version 0.0.7-alpha
                    
#r "nuget: Dali, 0.0.7-alpha"
                    
#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 Dali@0.0.7-alpha
                    
#: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=Dali&version=0.0.7-alpha&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Dali&version=0.0.7-alpha&prerelease
                    
Install as a Cake Tool

Dali - SurrealDB EF Core LINQ Provider

A complete example of building an EF Core–style LINQ provider for SurrealDB that transparently handles document, graph, and raw SQL query modes.


Architecture

Your LINQ Query
      │
      ▼
SurrealQueryable<T>          ← IQueryable<T> + IAsyncEnumerable<T>
      │
      ▼
SurrealQueryProvider          ← IQueryProvider — routing + async helpers
      │
      ▼
SurrealExpressionVisitor      ← Walks Expression tree → SurrealQL string
      │   ├── Document mode:  WHERE / ORDER BY / LIMIT / START
      │   ├── Graph mode:     ->edge->target traversal paths
      │   └── SQL mode:       raw SurrealQL pass-through
      ▼
TranslatedQuery               ← (SurrealQL string, QueryMode, ElementType)
      │
      ▼
SurrealHttpExecutor           ← POST /sql → parse [{ status, result }]
      │
      ▼
SurrealDB (HTTP API)

Query Modes

1. Document Mode

Standard LINQ → SurrealQL SELECT:

var adults = await ctx.People
    .Where(p => p.Age >= 18 && p.Name.Contains("A"))
    .OrderBy(p => p.Name)
    .Skip(20).Take(10)
    .ToListAsync();
// → SELECT * FROM person
//   WHERE (age >= 18) AND (string::contains(name, 'A'))
//   ORDER BY name ASC LIMIT 10 START 20

2. Graph Mode

Edge creation and traversal:

// RELATE
await ctx.Graph.RelateAsync<Knows>("person:alice", "person:bob",
    new Knows { Strength = 0.9 });
// → RELATE person:alice->knows->person:bob CONTENT {...}

// Traverse out
var friends = await ctx.Graph.TraverseOutAsync<Knows, Person>("person:alice");
// → SELECT ->knows->person.* FROM person:alice

// LINQ-style traverse
var result = await ctx.People
    .Where(p => p.Name == "Alice")
    .Traverse<Knows, Person>("out")
    .Where(p => p.Age > 18)
    .ToListAsync();
// → SELECT ->knows->person.* FROM person
//   WHERE name = 'Alice' AND age > 18

3. SQL / Analytic Mode

Full SurrealQL pass-through:

var stats = await ctx.QueryAsync<...>("""
    SELECT math::mean(age) AS avg, count() AS total
    FROM person GROUP ALL;
""");

// Or escape hatch inside LINQ:
var vips = await ctx.People
    .Where(p => p.Age > 18)
    .Raw("tags CONTAINS 'vip'")
    .ToListAsync();

Supported LINQ Operators

LINQ SurrealQL
.Where() WHERE field op value
.Select() SELECT field1, field2
.OrderBy() ORDER BY field ASC
.OrderByDescending() ORDER BY field DESC
.Skip(n) START n
.Take(n) LIMIT n
&& / \|\| AND / OR
! NOT
.Contains(str) string::contains(field, val)
.StartsWith() string::startsWith(field, val)
list.Contains() field CONTAINS val
.Traverse<E,T>() ->edge->target.*
.Raw(surql) Injected verbatim into WHERE

Key Files

File Purpose
Core/SurrealModels.cs RecordId, SurrealEntity, SurrealEdge<TIn,TOut>, domain models
Query/ExpressionVisitor.cs Walks LINQ trees → SurrealQL strings
Infrastructure/QueryProvider.cs IQueryProvider, SurrealQueryable<T>, SurrealDbSet<T>
Infrastructure/SurrealContext.cs DbContext equivalent, SurrealGraphApi, HTTP executor
Extensions/Extensions.cs ToListAsync, Traverse<>, Raw(), DI registration
Examples.cs Full usage examples for all three modes

Production Considerations

  • Connection pooling — reuse HttpClient via IHttpClientFactory
  • Parameter binding — replace string interpolation with $param placeholders to prevent SurrealQL injection
  • Schema migration — wrap DEFINE TABLE / FIELD / INDEX calls in versioned migration scripts
  • Live queries — use WebSocket client for LIVE SELECT subscriptions
  • Auth — swap Basic auth for JWT via SIGNIN / AUTHENTICATE
  • Caching — add result caching at the ISurrealQueryExecutor layer
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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 (4)

Showing the top 4 NuGet packages that depend on Dali:

Package Downloads
Dali.EntityFrameworkCore

EF Core bridge for Dali — coordinated transactions between SurrealDB (Dali) and Entity Framework Core

Dali.ML

Experimental ML support for Dali — SurrealML model inference via SurrealQL ml:: functions. Requires SurrealDB compiled with the 'ml' feature.

Dali.WolverineFx

SurrealDB-backed message persistence and transport for WolverineFx

Dali.AspNetIdentity

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.7-alpha 43 6/26/2026
0.0.6-alpha 51 6/24/2026