GORMDocs
GUIDES & COOKBOOK

Start from the problem you need to solve.

These recipes combine the documented core GORM model and query operators into common graph-persistence tasks. Advanced capabilities are documented separately. The core recipes that run against the published NuGet package are identified below; illustrative domain examples are not an assertion of provider parity.

RUNNABLE RECIPES

Verified against the published GORM NuGet package

The complete C# cookbook builds and runs in CI using GORM 3.1.0-preview.1. It includes assertions for LINQ, typed traversals, relationship loading, two-hop navigation and SQL translation.

var tasks = await db.Set<DeveloperNode>()
    .Where(x => x.Id == developerId)
    .Outgoing<WorksOnEdge, ProjectNode>()
    .ThenOutgoing<HasTaskEdge, TaskNode>()
    .ToListAsync();

The sample uses an in-memory graph: it verifies the public .NET API and results, but does not execute generated SQL. See the SQL Server verification matrix for live provider coverage. The browser Playground is still an illustrative JavaScript preview, not the compiled runtime.

FREE · NO SERVERRun the verified cookbook

Copy/paste the real, NuGet-only application.

RECIPE

Find direct dependencies of a service

var dependencies = await context.Set<ServiceNode>()
    .Where(x => x.Id == serviceId)
    .Outgoing<DependsOnEdge, ServiceNode>()
    .ToListAsync();

Use outgoing traversal when the current service is the source of a dependency relation.

TRY ITOpen in playground

Inspect the SQL Server Graph MATCH shape for this traversal.

RECIPE

Find everything that depends on a node

var dependents = await context.Set<ServiceNode>()
    .Where(x => x.Id == databaseId)
    .Incoming<DependsOnEdge, ServiceNode>()
    .ToListAsync();

This is useful for blast-radius questions where the selected node is the target of dependency edges.

RECIPE

Reconstruct topology at incident time

var historicalDependencies = await context.Set<ServiceNode>()
    .AsOf(incidentStartedAt)
    .Where(x => x.Id == serviceId)
    .Outgoing<DependsOnEdge, ServiceNode>()
    .ToListAsync();

Use this pattern when current topology has already changed and you need to understand what was connected when an incident began.

Consistency matters

The meaningful result is a historical graph, not current relationships combined with historical node state.

RECIPE

Load a domain object with related graph data

var person = await context.Set<PersonNode>()
    .Include(x => x.Projects)
    .SingleAsync(x => x.Id == personId);

Prefer relationship loading when application code needs the connected object graph rather than a traversal result.

RECIPE

Keep operational queries bounded

var active = await context.Set<ServiceNode>()
    .Where(x => x.State == ServiceState.Active)
    .OrderBy(x => x.Name)
    .Take(100)
    .ToListAsync();

Bounded reads reduce accidental fan-out and make interactive tooling more predictable. Combine them with deterministic ordering.

RECIPE

Split fast graph tests from provider verification

FAST TEST

Use the in-memory execution path to validate domain behavior, traversal intent and deterministic scenarios without requiring SQL Server for every test.

PROVIDER TEST

Keep a focused SQL Server suite for translation, temporal semantics, concurrency and other provider-specific behavior.

The key is not to confuse provider-independent test speed with provider equivalence.

ADVANCED RECIPE

Analyze impact without mutating the graph

Graph Intelligence is intended to derive paths, affected topology and other analysis from ordinary GORM graph state. Keep that analysis read-only; an application should explicitly decide whether insight leads to a mutation.

API statusThe capability exists in public source but is still experimental; consult the preview assembly for exact APIs.Read capability docs →
ADVANCED RECIPE

Preview graph persistence work before applying it

The ChangeSet & transaction compiler is intended to make ordered writes, rollback semantics and conflicts inspectable before execution.

API statusPublic source is available; exact advanced API names and behavior must be validated against the preview NuGet assembly.Read capability docs →
CHOOSING AN API

Traversal, Include, analysis or mutation planning?

Outgoing / IncomingYou are asking which nodes are connected through a specific path.
Include / ThenIncludeYou want a connected object graph materialized.
Graph IntelligenceYou want derived insight such as impact, centrality or routing; advanced API requires package-level verification.
ChangeSetYou want persistence work to be inspectable; exact public API pending migration validation.