ToolUp.Graph.Projection
0.20.1
Prefix Reserved
See the version list below for details.
dotnet add package ToolUp.Graph.Projection --version 0.20.1
NuGet\Install-Package ToolUp.Graph.Projection -Version 0.20.1
<PackageReference Include="ToolUp.Graph.Projection" Version="0.20.1" />
<PackageVersion Include="ToolUp.Graph.Projection" Version="0.20.1" />
<PackageReference Include="ToolUp.Graph.Projection" />
paket add ToolUp.Graph.Projection --version 0.20.1
#r "nuget: ToolUp.Graph.Projection, 0.20.1"
#:package ToolUp.Graph.Projection@0.20.1
#addin nuget:?package=ToolUp.Graph.Projection&version=0.20.1
#tool nuget:?package=ToolUp.Graph.Projection&version=0.20.1
ToolUp.Graph.Projection
The entity→graph projection bridge. It projects your IEntityStore
records — and their declared relationship edges — into an IGraphStore as a
derived read-model, so a consumer who models their domain as entities +
relationships gets graph-traversal queries for free without maintaining two
parallel data models by hand.
IEntityStore stays the system of record; the graph is a queryable
projection derived from it. You write entities; the graph is kept in sync.
It is opt-in and additive (GP 13). A deployment that does not compose it pays nothing, and its entity store behaves exactly as before.
What projects
- Each entity → a node. Node label = the entity
Type;NodeId=entity:{Type}:{Id}(deterministic — re-projecting yields the same id); properties = the record fields, mapped to graphPropertyValues. Mapping honours the graph substrate's precision floor: integers →PInt(int64), reals anddecimal→PFloat(float), timestamps →PDateTime. - Each declared relationship → an edge. A Phase-19c relationship whose
foreign key lives on the entity (an
Outgoingforeign-key cardinality) projects one directed edge: label = the relationship name,From= the declaring entity,To= the foreign-key target.Incominginverse views are projected from the entity that carries the key;ManyToManyjoin-resolved edges are out of scope.
The mapping is a pure function (EntityProjection.projectEntity),
shared by both the sync and rebuild paths so they never drift.
Keeping in sync
- Incremental — the bridge subscribes to the entity-store lifecycle
signal (
EntityCreated/EntityUpdated/EntityDeleted): create / update upserts the node + edges; delete removes the node + incident edges. Deterministic ids make a re-apply a no-op. Sync failures surface as retryable data, never a throw, and alastProjectedVersionper entity makes a missed signal reconcilable. - Rebuild —
RebuildProjection(scopeId)reconciles the whole scope: upsert every present entity, remove orphaned nodes whose source entity is gone. Returns aProjectionReport(counts) and is idempotent (a no-op over an unchanged store). Use it to bootstrap over an existing entity store and to heal drift.
Composition
open ToolUp.Graph.Projection
let app =
ServerApp.create "my-app"
|> ServerApp.withEntityStore
|> ServerApp.withEntity bookRegistration
|> ServerApp.withEntity authorRegistration
|> ServerApp.withEntityGraphProjection // opt in (requires an IGraphStore)
// Wire the bridge from a ServiceConfig extension (applied after the base
// stores + audit log are registered). No-op when not opted in.
let enrollments =
[ ProjectedEntityType.ofRegistration bookRegistration
ProjectedEntityType.ofRegistration authorRegistration ]
let addProjection (services: IServiceCollection) =
EntityGraphProjectionCompose.wire services app.Config enrollments
services
The bridge references IEntityStore (a server-tier type), so — like a
graph engine companion — the deployment wires it; the SDK core does not
reference it back. Server-only: it ships a DLL, not fable/ source.
Not in scope
Reverse graph→entity projection; transactional entity+graph atomicity; custom projection (computed / filtered / multi-entity-to-one-node mappings). The default mapping is field-for-field + declared-relationship- for-edge.
License
Apache-2.0. Part of the ToolUp Platform SDK.
| Product | Versions 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. |
-
net10.0
- FSharp.Core (>= 10.1.300)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.7)
- ToolUp.Graph.Core (>= 0.20.1)
- ToolUp.Platform.Server (>= 0.20.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.