ClonePlan

Models & Types · AiDotNet.Models

Describes how to reproduce one type: which members are configuration, and how each is carried.

How It Works

A plan is produced at compile time by the clone plan generator and stored in CloneRegistry. Nothing here is decided at clone time, so a clone cannot depend on the state of the object it is copying — which is what makes the result reviewable and testable rather than emergent.

Why a plan rather than generated copy code: a Roslyn generator can only add members to a partial type, and none of the 594 options classes are partial. Emitting a plan instead keeps every one of them untouched while still deciding correctness at compile time, and means a class written by a user works without them declaring anything at all.

Constructors

Constructor Summary
ClonePlan(Type type, IReadOnlyList<ClonePlanEntry> entries, IReadOnlyList<string> constructorParameters, IReadOnlyList<IReadOnlyList<string>> constructorCandidates) Initializes a new instance of the ClonePlan class.
ClonePlan(Type type, IReadOnlyList<ClonePlanEntry> entries, IReadOnlyList<string> constructorParameters, IReadOnlyList<IReadOnlyList<string>> constructorCandidates, IReadOnlyList<IReadOnlyList<CloneConstructorArgumentBinding>> constructorBindings) Creates a plan with optional declaring-member-aware bindings.

Properties

Property Summary
IReadOnlyList<ClonePlanEntry> Entries { get; } Gets the configuration members carried by a clone, in a stable order.
IReadOnlyList<IReadOnlyList<CloneConstructorArgumentBinding>> ConstructorBindings { get; } Explicit argument bindings for plans whose selected members would be ambiguous by name.
IReadOnlyList<IReadOnlyList<string>> ConstructorCandidates { get; } Gets every constructor the type can be rebuilt through, widest first.
IReadOnlyList<string> ConstructorParameters { get; } Gets the configuration property names feeding this type’s constructor, in parameter order.
Type Type { get; } Gets the type this plan reproduces.