Skip to content

Compono.CompositionTypeRuleBuilder T .UseConstructor

Compono

Compono.CompositionTypeRuleBuilder<T>

CompositionTypeRuleBuilder\<T>.UseConstructor Method

Overloads
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.

CompositionTypeRuleBuilder\<T>.UseConstructor() Method

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.

public void UseConstructor();

CompositionTypeRuleBuilder\<T>.UseConstructor\<T1,T2,T3,T4,T5,T6>() Method

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.

public void UseConstructor<T1,T2,T3,T4,T5,T6>();

Type parameters

T1

The first (and only) parameter type of the constructor to select.

T2

T3

T4

T5

T6

Remarks

This is a compile-time-only configuration signal, not a runtime factory.Compono.Generators reads this call's own source (its containing type argument and this method's own type arguments) to select T's constructor for the single, compilation-wide generated composition plan - this method itself does nothing at runtime. Contrast with Use(Func<ICompositionContext,T>), which registers a real runtime factory the consumer fully controls (including calling arbitrary code, wrapping an existing instance, or supplying a value Compono could never compose on its own) - use UseConstructor when Compono should keep composing T normally and you only need to say which entry point to use; use Use(Func<ICompositionContext,T>) when you need to supply or construct T yourself.

Scope is compilation-wide, not per-profile. A generated composition plan is one plan per type, shared by every composition path that reaches it - not a per-profile variant. A selection made anywhere in the compilation applies everywhere T is composed; a second, different selection for the same T anywhere in the compilation is a compile-time conflict (CMP0033); an identical repeated selection is accepted (idempotent). Per-profile constructor selection is not supported.

If no constructor of T has exactly this parameter-type list (in this order), this is a compile-time diagnostic (CMP0034), not a silent fallback to another constructor. If T already has exactly one accessible constructor, this call is unnecessary but harmless.

CompositionTypeRuleBuilder\<T>.UseConstructor\<T1,T2,T3,T4,T5>() Method

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.

public void UseConstructor<T1,T2,T3,T4,T5>();

Type parameters

T1

The first (and only) parameter type of the constructor to select.

T2

T3

T4

T5

Remarks

This is a compile-time-only configuration signal, not a runtime factory.Compono.Generators reads this call's own source (its containing type argument and this method's own type arguments) to select T's constructor for the single, compilation-wide generated composition plan - this method itself does nothing at runtime. Contrast with Use(Func<ICompositionContext,T>), which registers a real runtime factory the consumer fully controls (including calling arbitrary code, wrapping an existing instance, or supplying a value Compono could never compose on its own) - use UseConstructor when Compono should keep composing T normally and you only need to say which entry point to use; use Use(Func<ICompositionContext,T>) when you need to supply or construct T yourself.

Scope is compilation-wide, not per-profile. A generated composition plan is one plan per type, shared by every composition path that reaches it - not a per-profile variant. A selection made anywhere in the compilation applies everywhere T is composed; a second, different selection for the same T anywhere in the compilation is a compile-time conflict (CMP0033); an identical repeated selection is accepted (idempotent). Per-profile constructor selection is not supported.

If no constructor of T has exactly this parameter-type list (in this order), this is a compile-time diagnostic (CMP0034), not a silent fallback to another constructor. If T already has exactly one accessible constructor, this call is unnecessary but harmless.

CompositionTypeRuleBuilder\<T>.UseConstructor\<T1,T2,T3,T4>() Method

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.

public void UseConstructor<T1,T2,T3,T4>();

Type parameters

T1

The first (and only) parameter type of the constructor to select.

T2

T3

T4

Remarks

This is a compile-time-only configuration signal, not a runtime factory.Compono.Generators reads this call's own source (its containing type argument and this method's own type arguments) to select T's constructor for the single, compilation-wide generated composition plan - this method itself does nothing at runtime. Contrast with Use(Func<ICompositionContext,T>), which registers a real runtime factory the consumer fully controls (including calling arbitrary code, wrapping an existing instance, or supplying a value Compono could never compose on its own) - use UseConstructor when Compono should keep composing T normally and you only need to say which entry point to use; use Use(Func<ICompositionContext,T>) when you need to supply or construct T yourself.

Scope is compilation-wide, not per-profile. A generated composition plan is one plan per type, shared by every composition path that reaches it - not a per-profile variant. A selection made anywhere in the compilation applies everywhere T is composed; a second, different selection for the same T anywhere in the compilation is a compile-time conflict (CMP0033); an identical repeated selection is accepted (idempotent). Per-profile constructor selection is not supported.

If no constructor of T has exactly this parameter-type list (in this order), this is a compile-time diagnostic (CMP0034), not a silent fallback to another constructor. If T already has exactly one accessible constructor, this call is unnecessary but harmless.

CompositionTypeRuleBuilder\<T>.UseConstructor\<T1,T2,T3>() Method

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.

public void UseConstructor<T1,T2,T3>();

Type parameters

T1

The first (and only) parameter type of the constructor to select.

T2

T3

Remarks

This is a compile-time-only configuration signal, not a runtime factory.Compono.Generators reads this call's own source (its containing type argument and this method's own type arguments) to select T's constructor for the single, compilation-wide generated composition plan - this method itself does nothing at runtime. Contrast with Use(Func<ICompositionContext,T>), which registers a real runtime factory the consumer fully controls (including calling arbitrary code, wrapping an existing instance, or supplying a value Compono could never compose on its own) - use UseConstructor when Compono should keep composing T normally and you only need to say which entry point to use; use Use(Func<ICompositionContext,T>) when you need to supply or construct T yourself.

Scope is compilation-wide, not per-profile. A generated composition plan is one plan per type, shared by every composition path that reaches it - not a per-profile variant. A selection made anywhere in the compilation applies everywhere T is composed; a second, different selection for the same T anywhere in the compilation is a compile-time conflict (CMP0033); an identical repeated selection is accepted (idempotent). Per-profile constructor selection is not supported.

If no constructor of T has exactly this parameter-type list (in this order), this is a compile-time diagnostic (CMP0034), not a silent fallback to another constructor. If T already has exactly one accessible constructor, this call is unnecessary but harmless.

CompositionTypeRuleBuilder\<T>.UseConstructor\<T1,T2>() Method

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.

public void UseConstructor<T1,T2>();

Type parameters

T1

The first (and only) parameter type of the constructor to select.

T2

Remarks

This is a compile-time-only configuration signal, not a runtime factory.Compono.Generators reads this call's own source (its containing type argument and this method's own type arguments) to select T's constructor for the single, compilation-wide generated composition plan - this method itself does nothing at runtime. Contrast with Use(Func<ICompositionContext,T>), which registers a real runtime factory the consumer fully controls (including calling arbitrary code, wrapping an existing instance, or supplying a value Compono could never compose on its own) - use UseConstructor when Compono should keep composing T normally and you only need to say which entry point to use; use Use(Func<ICompositionContext,T>) when you need to supply or construct T yourself.

Scope is compilation-wide, not per-profile. A generated composition plan is one plan per type, shared by every composition path that reaches it - not a per-profile variant. A selection made anywhere in the compilation applies everywhere T is composed; a second, different selection for the same T anywhere in the compilation is a compile-time conflict (CMP0033); an identical repeated selection is accepted (idempotent). Per-profile constructor selection is not supported.

If no constructor of T has exactly this parameter-type list (in this order), this is a compile-time diagnostic (CMP0034), not a silent fallback to another constructor. If T already has exactly one accessible constructor, this call is unnecessary but harmless.

CompositionTypeRuleBuilder\<T>.UseConstructor\<T1>() Method

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.

public void UseConstructor<T1>();

Type parameters

T1

The first (and only) parameter type of the constructor to select.

Remarks

This is a compile-time-only configuration signal, not a runtime factory.Compono.Generators reads this call's own source (its containing type argument and this method's own type arguments) to select T's constructor for the single, compilation-wide generated composition plan - this method itself does nothing at runtime. Contrast with Use(Func<ICompositionContext,T>), which registers a real runtime factory the consumer fully controls (including calling arbitrary code, wrapping an existing instance, or supplying a value Compono could never compose on its own) - use UseConstructor when Compono should keep composing T normally and you only need to say which entry point to use; use Use(Func<ICompositionContext,T>) when you need to supply or construct T yourself.

Scope is compilation-wide, not per-profile. A generated composition plan is one plan per type, shared by every composition path that reaches it - not a per-profile variant. A selection made anywhere in the compilation applies everywhere T is composed; a second, different selection for the same T anywhere in the compilation is a compile-time conflict (CMP0033); an identical repeated selection is accepted (idempotent). Per-profile constructor selection is not supported.

If no constructor of T has exactly this parameter-type list (in this order), this is a compile-time diagnostic (CMP0034), not a silent fallback to another constructor. If T already has exactly one accessible constructor, this call is unnecessary but harmless.