Specifies the direction of the data flow to which a contract applies. Contracts can validate or transform values at different points in the data flow: when values are received (input/preconditions), when values are returned (output/postconditions), or both.
Namespace: Metalama.Framework.Aspects
Assembly: Metalama.Framework.dll
Syntax
[RunTimeOrCompileTime]
public enum ContractDirectionRemarks
Understanding contract directions is crucial for implementing effective validation:
- Input contracts validate values coming into a method or being assigned to a property (preconditions).
- Output contracts validate values being returned from a method or property getter (postconditions).
- Both applies validation in both directions, useful for ref parameters.
The Default direction automatically selects the appropriate direction based on the target declaration type.
Fields
| Name | Description |
|---|---|
| Both | Applies to both Input and Output data flows. The contract validates:
ref parameters where the value flows in both directions.
|
| Default | Uses the default direction based on the target declaration type:
|
| Input | Validates the input data flow (precondition):
|
| None | Disables the contract. The contract will not be applied. |
| Output | Validates the output data flow (postcondition):
|