Compono.CollectionPlanCache T
Compono¶
Compono¶
CollectionPlanCache\<T> Class¶
Holds the generated collection ICompositionPlan<T> for the closed collection type T (e.g. List<Address>), per docs/adr/0014-generator-emitted-collection-plans.md.
Type parameters¶
T
The closed collection type the cached plan constructs.
Inheritance System.Object → CollectionPlanCache\<T>
Remarks¶
Mirrors PlanCache<T> exactly - a closed generic static field is a direct field read on Compono.CompositionContext's hot path, not a typeof(T)-keyed dictionary lookup and not runtime reflection. Kept as a distinct cache from PlanCache<T> rather than reused for both: dispatch through this cache happens at stage 7 (built-in value providers), after registrations/profile/semantic/test-double providers have already had first refusal, whereas PlanCache<T> dispatch is stage 8.
Instance is populated exactly once, by a generated module initializer in the consuming assembly (never by Compono itself) - the same cross-assembly reason PlanCache<T>'s setter is public despite coding-standards.md's "no static singletons" rule.
When every type composing the closed T is a BCL type (e.g. List<int>), this closed instantiation's home context is the non-collectible default context, even though the plan instance stored in it is defined in the consuming assembly - if that assembly is loaded into a collectible AssemblyLoadContext, this field permanently roots it. Deferred - see docs/architecture.md's Open Architectural Decisions.
| Properties | |
|---|---|
| Instance | The generated collection plan for T, or null if none has been registered - either because T was never discovered in the transitive composition graph reachable from a Composer.Create<T>() call site, or because the consuming assembly's module initializers haven't run yet. |