Interface IDependencyConstructor
- Namespace
- LfrlAnvil.Dependencies
- Assembly
- LfrlAnvil.Dependencies.dll
Represents a constructor of dependency instances.
public interface IDependencyConstructor
Properties
Info
ConstructorInfo to use for creating dependency instances. Null value means that an attempt will be made to find best suited constructor from Type.
ConstructorInfo? Info { get; }
Property Value
Remarks
Best suited constructor is found by scanning all constructors of a type and scoring them based on the following rules:
- Public constructors start with 1 point, private constructors start with 0 points.
- If at least one parameter cannot be resolved or its resolver's type is not compatible, then the constructor is marked as not eligible.
- Each parameter with a custom factory resolution adds 3 points.
- Each parameter with a custom non-factory resolution that is not a captive dependency adds 3 points.
- Each automatically resolvable parameter that is not a captive dependency adds 2 points.
- Each unresolvable optional parameter (e.g. with a default value) with a custom non-factory resolution adds 2 points.
- Each unresolvable optional parameter (e.g. with a default value) adds 1 point.
- Each parameter with a custom non-factory resolution that is a captive dependency adds 1 point.
InvocationOptions
Specifies custom constructor invocation options.
IDependencyConstructorInvocationOptions InvocationOptions { get; }
Property Value
Type
Type to use for resolving dependency instances. Null value means that the dependency's type itself will be used.
Type? Type { get; }