Skip to content

Compono.CompositionTypeRuleBuilder T

Compono

Compono

CompositionTypeRuleBuilder\<T> Class

A thin, type-scoped view over a CompositionBuilder's shared accumulator state - returned by For<T>(). Calling Use(T)/ Use(Func<ICompositionContext,T>) directly registers a type rule; calling Member<TMember>(Expression<Func<T,TMember>>) first returns a further-scoped CompositionMemberRuleBuilder<TParent,TMember> whose own Use/ WithCollectionSize register a member rule instead. See docs/adr/0020-composition-configuration-rules.md.

public sealed class CompositionTypeRuleBuilder<T>

Type parameters

T

The type this rule builder is scoped to.

Inheritance System.Object → CompositionTypeRuleBuilder\<T>

Methods
Member<TMember>(Expression<Func<T,TMember>>) Scopes this rule to a single member of T - parsed immediately, at the point this method is called, not deferred to Build().
Use(Func<ICompositionContext,T>) Registers a type rule whose value is produced by factory - matches any stage-4 request for exactly T, regardless of which member/position requested it.
Use(T) Registers a type rule that always produces value - matches any stage-4 request for exactly T, regardless of which member/position requested it.
UseConstructor() Selects T's parameterless constructor, for Compono.Generators' compile-time composition plan - the arity-0 counterpart to UseConstructor<T1>(), needed because C# has no empty generic type-argument-list syntax to select a parameterless constructor through the generic overloads alone. See UseConstructor<T1>()'s remarks - every rule there (compile-time-only marker, Register<T> distinction, compilation-wide scope, CMP0033/CMP0034) applies identically here.
UseConstructor<T1,T2,T3,T4,T5,T6>() Selects the constructor of T whose parameter types are exactly (T1), in order, for Compono.Generators' compile-time composition plan - T is still composed by Compono exactly as an unambiguous type would be (every parameter resolved through the ordinary composition graph, recursively), the consumer only identifies which constructor to use. See docs/adr/0052-compile-time-composition-discovery-boundary-for-registered-and-nested-resolved-types.md.
UseConstructor<T1,T2,T3,T4,T5>() Selects the constructor of T whose parameter types are exactly (T1), in order, for Compono.Generators' compile-time composition plan - T is still composed by Compono exactly as an unambiguous type would be (every parameter resolved through the ordinary composition graph, recursively), the consumer only identifies which constructor to use. See docs/adr/0052-compile-time-composition-discovery-boundary-for-registered-and-nested-resolved-types.md.
UseConstructor<T1,T2,T3,T4>() Selects the constructor of T whose parameter types are exactly (T1), in order, for Compono.Generators' compile-time composition plan - T is still composed by Compono exactly as an unambiguous type would be (every parameter resolved through the ordinary composition graph, recursively), the consumer only identifies which constructor to use. See docs/adr/0052-compile-time-composition-discovery-boundary-for-registered-and-nested-resolved-types.md.
UseConstructor<T1,T2,T3>() Selects the constructor of T whose parameter types are exactly (T1), in order, for Compono.Generators' compile-time composition plan - T is still composed by Compono exactly as an unambiguous type would be (every parameter resolved through the ordinary composition graph, recursively), the consumer only identifies which constructor to use. See docs/adr/0052-compile-time-composition-discovery-boundary-for-registered-and-nested-resolved-types.md.
UseConstructor<T1,T2>() Selects the constructor of T whose parameter types are exactly (T1), in order, for Compono.Generators' compile-time composition plan - T is still composed by Compono exactly as an unambiguous type would be (every parameter resolved through the ordinary composition graph, recursively), the consumer only identifies which constructor to use. See docs/adr/0052-compile-time-composition-discovery-boundary-for-registered-and-nested-resolved-types.md.
UseConstructor<T1>() Selects the constructor of T whose parameter types are exactly (T1), in order, for Compono.Generators' compile-time composition plan - T is still composed by Compono exactly as an unambiguous type would be (every parameter resolved through the ordinary composition graph, recursively), the consumer only identifies which constructor to use. See docs/adr/0052-compile-time-composition-discovery-boundary-for-registered-and-nested-resolved-types.md.