MASS4.Graph.Generator
1.0.0
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
<PackageReference Include="MASS4.Graph.Generator" Version="1.0.0" />
<PackageVersion Include="MASS4.Graph.Generator" Version="1.0.0" />
<PackageReference Include="MASS4.Graph.Generator" />
paket add MASS4.Graph.Generator --version 1.0.0
#r "nuget: MASS4.Graph.Generator, 1.0.0"
#:package MASS4.Graph.Generator@1.0.0
#addin nuget:?package=MASS4.Graph.Generator&version=1.0.0
#tool nuget:?package=MASS4.Graph.Generator&version=1.0.0
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 aPortTypeand its dataflow storage binding together. An optionalSerializerpreserves custom wire formats;JsonContextuses source-generatedJsonTypeInfo<T>. A class value gets reference storage and an unmanaged value gets inline storage.[GraphNode(id, name)]emitsType, with ordered[GraphPort(member, key, name, direction, typeId, typeof(T))]declarations. Inputs default to single connections and outputs to multiple;Multiplicityoverrides that.Keys.Memberexposes the persistent key, andIndices.Memberfollows 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 declareVolatileand requiredFeatures; the generatedDataflowNodeenforces 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, useValue = typeof(ValueDeclaration)andMemberinstead ofJsonContext: 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 withGuardType = "boolean-type-guid"usesStateNodes.CreateGuardedTransitionand automatically emitsStateNodes.AddTransitionMigrationfor its domain identity. Custom transition payloads such asAfterPayloadremain 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.
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.