MASS4.Graph.Generator 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package MASS4.Graph.Generator --version 1.0.0
                    
NuGet\Install-Package MASS4.Graph.Generator -Version 1.0.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="MASS4.Graph.Generator" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MASS4.Graph.Generator" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="MASS4.Graph.Generator" />
                    
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 MASS4.Graph.Generator --version 1.0.0
                    
#r "nuget: MASS4.Graph.Generator, 1.0.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 MASS4.Graph.Generator@1.0.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=MASS4.Graph.Generator&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=MASS4.Graph.Generator&version=1.0.0
                    
Install as a Cake Tool

MASS4.Graph.Generator

MASS4.Graph.Generator is a compile-time analyzer reference. It targets net10.0 and runs in the .NET 10+ SDK compiler; framework-hosted compiler environments are not supported. It has a private Roslyn dependency and adds no runtime dependency to the core or consumers. Reference Graph.Generator.csproj with OutputItemType="Analyzer" and ReferenceOutputAssembly="false", or install the analyzer package alongside the core and the semantics packages your declarations use.

Declare one [assembly: GraphModule("Your.Namespace.Module", typeof(DataflowNodes))] per assembly. The analyzer supplies internal declaration attributes during post-initialization; they add no public runtime API to the core. Prerequisites are explicit types exposing Register(GraphTypeRegistry); registration never scans assemblies. Declarations are top-level, nongeneric static partial classes. See the shader, FSM and compositor declarations for complete examples.

  • [GraphValue(id, name, typeof(T))] emits a PortType and its dataflow storage binding together. An optional Serializer preserves custom wire formats; JsonContext uses source-generated JsonTypeInfo<T>. A class value gets reference storage and an unmanaged value gets inline storage.
  • [GraphNode(id, name)] emits Type, with ordered [GraphPort(member, key, name, direction, typeId, typeof(T))] declarations. Inputs default to single connections and outputs to multiple; Multiplicity overrides that. Keys.Member exposes the persistent key, and Indices.Member follows declaration order for dataflow, state and control behaviors.
  • [GraphBehavior] emits the corresponding dataflow, control, state or transition binding. Dataflow declarations name a static evaluation method and can declare Volatile and required Features; the generated DataflowNode enforces those features through the backend's normal contract. Other semantics bind an explicit behavior implementation.
  • [GraphPayload(typeof(Payload), JsonContext = typeof(Context), DefaultFactory = nameof(Default))] emits serialization and the optional new-node default. For a single-value payload, use Value = typeof(ValueDeclaration) and Member instead of JsonContext: serialization reuses that value's serializer and constructs the wrapper directly.
  • [GraphSignal] and [GraphRenamedFrom] emit signal identities and rename entries. Renames apply to node and value declarations as well. IDs are always explicit GUIDs; source names never determine persistent identity. Port keys are scoped to their node, preserving existing documents that share keys across node types. New declarations can give every port its own key.
  • [GraphMigration(fromVersion, typeof(Owner), nameof(Owner.Migrate))] emits a migration step. A node with GuardType = "boolean-type-guid" uses StateNodes.CreateGuardedTransition and automatically emits StateNodes.AddTransitionMigration for its domain identity. Custom transition payloads such as AfterPayload remain independent of that legacy State payload migration.

The generated module implements IGraphTypeModule: registry.Add(new Module()) registers its prerequisites, types, renames and migrations. CreateDataflow, CreateControl and CreateState are emitted when their declarations need those semantics. Value declarations expose Bind(document, compiledGraph, variable) for typed unmanaged or reference handles; writable scopes are Input and External.

Node.Add(editor, payload) returns a handle with typed GraphInput<T> and GraphOutput<T> ports. editor.Connect(source.Out, target.In) only compiles for matching CLR types; explicit conversion nodes bridge differing types. Normal editor validation still checks persistent type identities, multiplicity and graph rules. Transition(editor, from.Exit, to.Enter, payload, trigger, priority) adds and wires a domain transition as one reversible, atomic edit. Reference outputs expose ReuseMember(context, state, static (previous, state) => ...), so behaviors can reuse their own buffers without a capturing delegate.

JSON contexts are user-declared with [JsonSerializable], including their naming policies and converters. Roslyn generators cannot see ordinary output from other generators, so the Graph generator consumes the context's generated metadata rather than emitting a context for the JSON generator to discover. Missing metadata fails explicitly during registration. This follows Roslyn's generator execution contract.

Build errors MG5001–MG5005 cover invalid/missing GUIDs, duplicate or still-registered renamed identities, duplicate node-local port keys or member names, malformed conversion shapes and unsupported declaration shapes. Conflicts across independently compiled assemblies remain registry errors at composition time.

The hand-written sample registrations remain the oracle. Sample tests compare type identities, ordered port declarations, defaults, value/payload JSON and reloads, then run scenarios through independently configured interpreters. The generated FSM fixture uses the hand library's simulated renamedSeePlayer release. Its domain guarded transition is also loaded from a version 1 payload, proving automatic migration registration. Generator tests check compiler diagnostics and emitted-code compilation; Graph.AotSmoke verifies registration and persistence in a native executable with JSON reflection disabled.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • net10.0

    • No dependencies.

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
1.2.0 92 11/4/2026
1.1.0 108 10/29/2026
1.0.0 106 10/28/2026