MetalamaAPI documentationPatterns APIMetalama.​Patterns.​ContractsContract­Templates
Open sandboxFocus

ContractTemplates Class

Provides default implementations for the code templates used by code contract aspects (derived from ContractBaseAttribute). This class can be derived and templates can be overridden. To register the new template implementations, use the Templates contract options.

Inheritance
ContractTemplates
Namespace: Metalama.Patterns.Contracts
Assembly: Metalama.Patterns.Contracts.dll
Syntax
public class ContractTemplates : Object, ITemplateProvider, ICompileTimeSerializable

Constructors

Name Description
ContractTemplates()

Properties

Name Description
TargetDisplayName

Gets a human-readable name of the target declaration.

TargetParameterName

Gets the name of the target parameter.

Methods

Name Description
OnCreditCardContractViolated(Object)

Template used by the CreditCardAttribute contract.

OnEmailAddressContractViolated(Object)

Template used by the EmailAttribute contract.

OnGreaterThanContractViolated(Object, Object)

Template used by the GreaterThanAttribute contract.

OnInvalidEnumValue(Object)

Template used by the EnumDataTypeAttribute contract.

OnLessThanContractViolated(Object, Object)

Template used by the LessThanAttribute contract.

OnNotEmptyContractViolated(Object)

Template used by the NotEmptyAttribute contract.

OnNotNullContractViolated(Object)

Template used by the NotNullAttribute contract.

OnPhoneContractViolated(Object)

Template used by the PhoneAttribute contract.

OnRangeContractViolated(Object, NumericRange)

Template used by the RangeAttribute contract.

OnRegularExpressionContractViolated(Object, Object)

Template used by the JetBrains.Annotations.RegexPatternAttribute contract.

OnRequiredContractViolated(Object)

Template used by the RequiredAttribute contract when the value is null.

OnRequiredContractViolatedBecauseOfEmptyString(Object)

Template used by the RequiredAttribute contract when the value is an empty string.

OnStrictlyGreaterThanContractViolated(Object, Object)

Template used by the StrictlyGreaterThanAttribute contract.

OnStrictlyLessThanContractViolated(Object, Object)

Template used by the StrictlyLessThanAttribute contract.

OnStrictRangeContractViolated(Object, NumericRange)

Template used by the StrictRangeAttribute contract.

OnStringLengthContractViolated(Object, Int32, Int32)

Template used by the StringLengthAttribute contract when both the lower and the upper bounds are specified.

OnStringMaxLengthContractViolated(Object, Int32)

Template used by the StringLengthAttribute contract when only the upper bound is specified.

OnStringMinLengthContractViolated(Object, Int32)

Template used by the StringLengthAttribute contract when only the lower bound is specified.

OnUrlContractViolated(Object)

Template used by the UrlAttribute contract.

See Also