PostSharp.ILAPI ReferencePost­Sharp.​Patterns.​Contracts
Open sandboxFocus

PostSharp.Patterns.Contracts Namespace

Classes

ContractExceptionFactory

Base class for contract exception factories. Implements chain of responsibility between concrete exception factories.

ContractExceptionInfo

This class holds the information from which the ContractExceptionFactory should create the exception.

ContractLocalizedTextProvider

Base class for contract error messages providers.

ContractServices

This class provides services supporting Contract aspects. By adding your own classes to the ExceptionFactory chain, you can change the way the exceptions are created when a contract is broken. By plugging into the LocalizedTextProvider chain, you can change the way the exception messages are generated. See the documentation for the classes for more details: ContractLocalizedTextProvider, ContractExceptionFactory.

CreditCardAttribute

Custom attribute that, when added to a field, property or parameter, throws an ArgumentException if the target is assigned a value that is not a valid credit card number. Null strings are accepted and do not throw an exception.

DefaultContractExceptionFactory

Default implementation of ContractExceptionFactory.

EmailAddressAttribute

Custom attribute that, when added to a field, property or parameter, throws an ArgumentException if the target is assigned a value that is not a valid email address. Null strings are accepted and do not throw an exception.

EnumDataTypeAttribute

Custom attribute that, when added to a field, property or parameter, throws an ArgumentException if the target is assigned a value that is not a valid member of an enumeration.

GreaterThanAttribute

Custom attribute that, when added to a field, property or parameter, throws an System.ArgumentOutOfRangeException if the target is assigned a value that is smaller than a given value.

LessThanAttribute

Custom attribute that, when added to a field, property or parameter, throws an System.ArgumentOutOfRangeException if the target is assigned a value that is greater than a given value.

LocationContractAttribute

Base class for other custom attributes in this namespace.

NegativeAttribute

Custom attribute that, when added to a field, property or parameter, throws an System.ArgumentOutOfRangeException if the target is assigned a value greater than zero.

NotEmptyAttribute

Custom attribute that, when added to a field, property or parameter, throws an ArgumentNullException if the target is assigned a null or empty value. The custom attributes can be added to locations of type String (where empty means zero characters), or ICollection, System.Collections.Generic.ICollection<> or IReadOnlyCollection<T> (where empty means zero items).

NotNullAttribute

Custom attribute that, when added to a field, property or parameter, throws an ArgumentNullException if the target is assigned a null value.

PhoneAttribute

Custom attribute that, when added to a field, property or parameter, throws an ArgumentException if the target is assigned a value that is not a valid phone number. Null strings are accepted and do not throw an exception.

PositiveAttribute

Custom attribute that, when added to a field, property or parameter, throws an System.ArgumentOutOfRangeException if the target is assigned a value smaller than zero.

PostconditionFailedException

The exception that is thrown when a postcondition contract was not fulfilled by a method.

RangeAttribute

Custom attribute that, when added to a field, property or parameter, throws an System.ArgumentOutOfRangeException if the target is assigned a value that is outside a given range.

RegularExpressionAttribute

Custom attribute that, when added to a field, property or parameter, throws an ArgumentException if the target is assigned a value that does not match a given regular expression. Null strings are accepted and do not throw an exception.

RequiredAttribute

Custom attribute that, when added to a field, property or parameter, throws:

  • an ArgumentNullException if the target is assigned a null value;
  • an System.ArgumentOutOfRangeException if the target is assigned an empty or white-space string.

StrictlyGreaterThanAttribute

Custom attribute that, when added to a field, property or parameter, throws an System.ArgumentOutOfRangeException if the target is assigned a value that is smaller than or equal to a given value.

StrictlyLessThanAttribute

Custom attribute that, when added to a field, property or parameter, throws an System.ArgumentOutOfRangeException if the target is assigned a value that is greater than or equal to a given value.

StrictlyNegativeAttribute

Custom attribute that, when added to a field, property or parameter, throws an System.ArgumentOutOfRangeException if the target is assigned a value greater than or equal to zero.

StrictlyPositiveAttribute

Custom attribute that, when added to a field, property or parameter, throws an System.ArgumentOutOfRangeException if the target is assigned a value smaller than or equal to zero.

StrictRangeAttribute

Custom attribute that, when added to a field, property or parameter, throws an System.ArgumentOutOfRangeException if the target is assigned a value that is not strictly within the given range.

StringLengthAttribute

Custom attribute that, when added to a field, property or parameter, throws an ArgumentException if the target is assigned a string of invalid length. Null strings are accepted and do not throw an exception.

UrlAttribute

Custom attribute that, when added to a field, property or parameter, throws an ArgumentException if the target is assigned a value that is not a valid URL starting with http://, https:// or ftp://. Null strings are accepted and do not throw an exception.

Interfaces

ILocationValidationHandler