Represents a way to pull a constructor parameter value from child constructors when propagating introduced parameters.
Namespace: Metalama.Framework.Advising
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public readonly struct PullActionRemarks
When a parameter is introduced to a constructor using IntroduceParameter(IAdviser<IConstructor>, string, IType, TypedConstant, IPullStrategy?, ImmutableArray<AttributeConstruction>),
child constructors (those that call the modified constructor via : base(...) or : this(...))
need to provide a value for this new parameter. A PullAction specifies how to obtain that value.
Common scenarios:
- None - Use the default value of the introduced parameter
- UseExistingParameter(IParameter) - Forward an existing parameter from the child constructor
- IntroduceParameterAndPull(string, IType, IExpression?, ImmutableArray<AttributeConstruction>) - Add a new parameter to the child constructor and forward its value
- UseExpression(IExpression) - Pass a custom expression (e.g., a constant or field access)
Properties
| Name | Description |
|---|---|
| Expression | Gets the expression to use for pulling the dependency when UseExpression(IExpression) or UseConstant(TypedConstant) is used. |
| None | Gets a PullAction that means that the dependency has to be set to its default value. |
Methods
| Name | Description |
|---|---|
| IntroduceParameterAndPull(string, IType, IExpression?, ImmutableArray<AttributeConstruction>) | |
| UseConstant(TypedConstant) | Creates a PullAction that means that the dependency should be assigned to a given TypedConstant. |
| UseExistingParameter(IParameter) | Creates a PullAction that means that the dependency should be pulled from an existing constructor parameter. |
| UseExpression(IExpression) | Creates a PullAction that means that the dependency should be assigned to a given IExpression. |