Open sandboxFocus

Class ContractBaseAttribute

Base class for all contract aspects defined in the Metalama.Patterns.Contracts namespace.

Namespace: Metalama.Patterns.Contracts
Assembly: Metalama.Patterns.Contracts.dll
Syntax
public abstract class ContractBaseAttribute : ContractAspect, IAspect<IParameter>, IEligible<IParameter>, IAspect<IFieldOrPropertyOrIndexer>, IEligible<IFieldOrPropertyOrIndexer>, IConditionallyInheritableAspect, IAspect, ICompileTimeSerializable, ITemplateProvider
Remarks

This class extends ContractAspect to provide common functionality for all contracts, including support for conditional inheritance via IConditionallyInheritableAspect, configurable contract direction via Direction, and hierarchical options integration via ContractOptions.

Constructors

Name Description
ContractBaseAttribute()

Properties

Name Description
Direction

Gets or sets the direction of the contract. When this property is not set, its default value is read from ContractOptions. When no value is defined in ContractOptions, the default value of this property is Default.

IsInheritable

Gets or sets a value indicating whether this contract should be inherited to derived types or overriding members. When this property is not set, its default value is read from ContractOptions. When no value is defined in ContractOptions, the default value of this property is true.

Methods

Name Description
GetActualDirection(IAspectBuilder, ContractDirection)

Gets the actual direction of the contract given the direction returned by GetDefinedDirection(IAspectBuilder), after resolving the Default value according to the characteristics of the target declaration, and after taking predecessors and secondary instances into account. The implementation of this method may return None to skip the aspect.

GetDefinedDirection(IAspectBuilder)

Gets or sets the direction of the data flow (Input, Output or Both) to which this contract applies, as defined by the current aspect. This method returns Default by default. When this method returns Default, the actual direction is determined according to the characteristics of the target declaration.

Extension Methods

See Also