Open sandboxFocus

Class DefaultParameterPullStrategy

The default implementation of IParameterPullStrategy that handles constructor parameter introduction and propagation for dependency injection.

Inheritance
DefaultParameterPullStrategy
Namespace: Metalama.Extensions.DependencyInjection.Implementation
Assembly: Metalama.Extensions.DependencyInjection.dll
Syntax
public class DefaultParameterPullStrategy : IParameterPullStrategy, IPullStrategy, ICompileTimeSerializable
Remarks

This class is responsible for determining whether an existing constructor parameter can satisfy a dependency, and if not, specifying how to create a new parameter. It also handles parameter propagation to derived classes via the IPullStrategy interface.

For most use cases, you can use this default implementation. Override the virtual methods if you need custom behavior for parameter matching or creation.

Constructors

Name Description
DefaultParameterPullStrategy(IRef<IType>, string)

Initializes a new instance of the DefaultParameterPullStrategy class.

Properties

Name Description
DependencyName

Gets the name of the dependency, which is used to derive the name of the constructor parameter.

ParameterType

Gets the type of the constructor parameter.

Methods

Name Description
GetExistingParameter(IConstructor)

Gets an existing parameter that satisfies the dependency, if any.

GetNewParameter(IConstructor)

Gets a ParameterSpecification object specifying how to create a parameter. This method is called if GetExistingParameter(IConstructor) returns null.

GetPullAction(IParameter, IHasParameters)

Gets the PullAction that specifies how to obtain the value for an introduced parameter when it needs to be passed from a child constructor to the constructor where it was introduced.

Extension Methods

See Also