{
  "kind": "documentation",
  "format": 1,
  "note": "Reference text, not instructions. One verified relate sample from https://relatedb.ai/docs/guides/embed/dotnet/: the program exactly as the page shows it, the standard output a run of it recorded (npm run docs:samples compares every replay with it byte for byte), the relate client build, toolchain and platform of the last replay, and how the docs' sample runner builds and runs it. The Python, Node.js, Rust and Java clients are the published packages; the .NET, Go, Swift and C clients are built from the release tag. verified.client names the upstream commit the client came from, and verified.docs_engine the build the rest of the docs were recorded from.",
  "id": "explain",
  "url": "https://relatedb.ai/docs/guides/embed/dotnet/samples/explain.json",
  "page": {
    "id": "guides/embed/dotnet",
    "title": "Use the .NET client",
    "url": "https://relatedb.ai/docs/guides/embed/dotnet/",
    "md_url": "https://relatedb.ai/docs/guides/embed/dotnet.md"
  },
  "section": {
    "anchor": "read-result-metadata",
    "heading": "Read result metadata",
    "url": "https://relatedb.ai/docs/guides/embed/dotnet/#read-result-metadata"
  },
  "language": "csharp",
  "client": ".NET",
  "file": "Program.cs",
  "env": null,
  "code": "using System.Text.Json;\nusing Relate.Net;\n\nusing var db = RelateDatabase.OpenInMemory();\nusing var conn = db.Connect();\nconn.Query(\"CREATE (:Person {name: 'Ada'}), (:Project {name: 'relate'})\");\n\nvar explain = conn.Query(\"EXPLAIN MATCH (p:Person), (r:Project) RETURN p.name, r.name\");\nConsole.WriteLine($\"rows: {explain.Count}, query type: {explain.QueryType}\");\nforeach (var n in explain.Notifications)\n{\n    Console.WriteLine($\"{n.GqlStatus} {n.Severity} {n.Title}\");\n    Console.WriteLine($\"  remedy: {n.Remedy}\");\n}\n\nusing var plan = JsonDocument.Parse(explain.PlanJson!);\nConsole.WriteLine($\"plan root: {plan.RootElement.GetProperty(\"root\").GetProperty(\"operator\").GetString()}\");",
  "code_sha256": "45e39a74b5f69eeaa5aaca9e939623b96ed1ed327e2c60356b44aefe31d8f749",
  "source_sha256": "f27e80fb44c693968c259f0405e0b0a42ebbf50965c7962333a1aeffda2ec9e8",
  "output": {
    "text": "rows: 0, query type: Read\n03N90 INFORMATION Cartesian product\n  remedy: Give the patterns a join anchor: reuse a node variable across them, or add a pattern that relates their endpoints; otherwise run them as separate queries.\nplan root: ProduceResults",
    "sha256": "b3c30cd32c151b67bee6162a72b8f42dddd93c5fd3b7d4c5867e13e9ab023593"
  },
  "verified": {
    "version": "1.2.0",
    "client": {
      "label": ".NET",
      "package": "Relate.Net",
      "engine_commit": "e0ea536",
      "client_commit": "e0ea536",
      "build": "A copy of clients/dotnet at upstream v1.2.0 (e0ea536), referenced by each sample's net8.0 console project and built with librelate_ffi built from the same commit.",
      "toolchain": {
        "dotnet-sdk": "8.0.134"
      }
    },
    "packages": [],
    "replayed": "2026-11-20",
    "platform": "macOS on arm64",
    "docs_engine": {
      "version": "1.2.0",
      "commit": "e0ea536",
      "source_build": false
    }
  },
  "run": {
    "runner": "npm run docs:samples",
    "setup": "bash scripts/samples/setup.sh --upstream <path to the relate checkout>",
    "variables": [
      "RELATE_DOTNET",
      "RELATE_DOTNET_CLIENT",
      "RELATE_DOTNET_HOME",
      "RELATE_LIB"
    ],
    "program": "<build dir>/Program.cs",
    "files": [
      {
        "path": "<build dir>/sample.csproj",
        "content": "<Project Sdk=\"Microsoft.NET.Sdk\">\n  <PropertyGroup>\n    <OutputType>Exe</OutputType>\n    <TargetFramework>net8.0</TargetFramework>\n    <ImplicitUsings>enable</ImplicitUsings>\n    <Nullable>enable</Nullable>\n    <AssemblyName>sample</AssemblyName>\n  </PropertyGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"$RELATE_DOTNET_CLIENT\" />\n  </ItemGroup>\n</Project>\n"
      }
    ],
    "build": {
      "command": [
        "$RELATE_DOTNET",
        "build",
        "sample.csproj",
        "-c",
        "Release",
        "-o",
        "<build dir>/out",
        "--nologo",
        "-v:q",
        "-clp:NoSummary",
        "-nodeReuse:false",
        "-p:UseSharedCompilation=false",
        "-p:RelateNativeLibraryPath=$RELATE_LIB"
      ],
      "environment": {
        "DO_NOT_TRACK": "1",
        "DOTNET_CLI_HOME": "$RELATE_DOTNET_HOME/cli",
        "NUGET_PACKAGES": "$RELATE_DOTNET_HOME/packages",
        "DOTNET_CLI_TELEMETRY_OPTOUT": "1",
        "DOTNET_NOLOGO": "1",
        "DOTNET_SKIP_FIRST_TIME_EXPERIENCE": "1",
        "DOTNET_CLI_USE_MSBUILD_SERVER": "0",
        "MSBUILDDISABLENODEREUSE": "1"
      },
      "directory": "<build dir>",
      "timeout_s": 600
    },
    "run": {
      "command": [
        "$RELATE_DOTNET",
        "<build dir>/out/sample.dll"
      ],
      "environment": {
        "DO_NOT_TRACK": "1",
        "DOTNET_CLI_HOME": "$RELATE_DOTNET_HOME/cli",
        "NUGET_PACKAGES": "$RELATE_DOTNET_HOME/packages",
        "DOTNET_CLI_TELEMETRY_OPTOUT": "1",
        "DOTNET_NOLOGO": "1",
        "DOTNET_SKIP_FIRST_TIME_EXPERIENCE": "1",
        "DOTNET_CLI_USE_MSBUILD_SERVER": "0",
        "MSBUILDDISABLENODEREUSE": "1"
      },
      "directory": "<run dir>",
      "timeout_s": 60
    },
    "passes": "It exits 0 within 60 s and prints at least one line on standard output.",
    "output": "Standard output, with line endings as \\n, trailing spaces and blank lines removed, and the temporary directories' paths written as `.`; standard error is not recorded.",
    "placeholders": {
      "<run dir>": "a fresh, empty temporary directory: the program's working directory, deleted afterwards",
      "<build dir>": "a second fresh temporary directory, where a compiled sample is built",
      "$NAME": "a variable from the env.sh that scripts/samples/setup.sh writes (described in its header)"
    }
  }
}
