Open sandboxFocus
  • TOC

Post­Sharp Documentation

Introduction

Deployment and Configuration

Adding Aspects to Code

Logging

Contracts

INotify­Property­Changed

Weak Event

XAML

Parent/Child, Visitor and Disposable

Undo/Redo

Caching

Multithreading

Developing Custom Aspects

Validating Architecture

Testing and Debugging

Miscellaneous

API Reference

Post­Sharp

Post­Sharp.​Aspects

Post­Sharp.​Aspects.​Advices

Post­Sharp.​Aspects.​Configuration

Post­Sharp.​Aspects.​Dependencies

Post­Sharp.​Aspects.​Internals

Post­Sharp.​Aspects.​Serialization

Post­Sharp.​Collections

Post­Sharp.​Constraints

Post­Sharp.​Extensibility

Post­Sharp.​Extensibility.​Build­Time­Logging

Post­Sharp.​Patterns

Post­Sharp.​Patterns.​Caching

Post­Sharp.​Patterns.​Caching.​Backends

Post­Sharp.​Patterns.​Caching.​Backends.​Azure

Post­Sharp.​Patterns.​Caching.​Backends.​Redis

Post­Sharp.​Patterns.​Caching.​Dependencies

Post­Sharp.​Patterns.​Caching.​Formatters

Post­Sharp.​Patterns.​Caching.​Implementation

Post­Sharp.​Patterns.​Caching.​Locking

Post­Sharp.​Patterns.​Caching.​Serializers

Post­Sharp.​Patterns.​Caching.​Value­Adapters

Post­Sharp.​Patterns.​Collections

Post­Sharp.​Patterns.​Collections.​Advices

Post­Sharp.​Patterns.​Contracts

Post­Sharp.​Patterns.​Diagnostics

Post­Sharp.​Patterns.​Diagnostics.​Adapters.​Asp­Net­Core

Post­Sharp.​Patterns.​Diagnostics.​Adapters.​Asp­Net­Framework

Post­Sharp.​Patterns.​Diagnostics.​Adapters.​Diagnostic­Source

Post­Sharp.​Patterns.​Diagnostics.​Adapters.​Http­Client

Post­Sharp.​Patterns.​Diagnostics.​Audit

Post­Sharp.​Patterns.​Diagnostics.​Backends

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Application­Insights

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Audit

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Common­Logging

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Console

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Event­Source

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Log4Net

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Microsoft

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Multiplexer

Post­Sharp.​Patterns.​Diagnostics.​Backends.​NLog

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Null

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Serilog

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Trace

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Trace­Source

Post­Sharp.​Patterns.​Diagnostics.​Contexts

Post­Sharp.​Patterns.​Diagnostics.​Correlation

Post­Sharp.​Patterns.​Diagnostics.​Custom

Post­Sharp.​Patterns.​Diagnostics.​Custom.​Messages

Post­Sharp.​Patterns.​Diagnostics.​Formatters

Post­Sharp.​Patterns.​Diagnostics.​Record­Builders

Post­Sharp.​Patterns.​Diagnostics.​Threading­Instrumentation

Post­Sharp.​Patterns.​Diagnostics.​Transactions

Post­Sharp.​Patterns.​Diagnostics.​Transactions.​Model

Post­Sharp.​Patterns.​Dynamic­Advising

Post­Sharp.​Patterns.​Formatters

Post­Sharp.​Patterns.​Model

Post­Sharp.​Patterns.​Model.​Controls

Post­Sharp.​Patterns.​Model.​Type­Adapters

Post­Sharp.​Patterns.​Recording

Post­Sharp.​Patterns.​Recording.​Operations

Post­Sharp.​Patterns.​Threading

Post­Sharp.​Patterns.​Threading.​Models

Post­Sharp.​Patterns.​Utilities

Post­Sharp.​Patterns.​Xaml

Post­Sharp.​Reflection

Post­Sharp.​Reflection.​Method­Body

Post­Sharp.​Serialization

  • Article

Class ContractLocalizedTextProvider

Base class for contract error messages providers.

Inheritance
ContractLocalizedTextProvider
Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common.dll
Syntax
public class ContractLocalizedTextProvider : LocalizedTextProvider
Remarks

An implementation would typically override the GetMessage(string) method. This method returns a formatting string where first 4 parameters have a well-known signification:

ParameterDescription
{0}Name of the declaration being validated (empty in case of return value).
{1}Kind of the declaration being validated.
{2}Name and kind of the declaration being validated.
{3}The invalid value.

Constructors

Name Description
ContractLocalizedTextProvider(ContractLocalizedTextProvider)

Initializes a new ContractLocalizedTextProvider.

Fields

Name Description
CreditCardErrorMessage

Identifier of the error message shown when CreditCardAttribute constraint is violated.

EmailAddressErrorMessage

Identifier of the error message shown when EmailAddressAttribute constraint is violated.

EnumDataTypeErrorMessage

Identifier of the error message shown when EnumDataTypeAttribute constraint is violated.

GreaterThanErrorMessage

Identifier of the error message shown when GreaterThanAttribute constraint is violated.

LessThanErrorMessage

Identifier of the error message shown when LessThanAttribute constraint is violated.

LocationContractErrorMessage

Identifier of the error message shown when LocationContractAttribute constraint is violated.

NotEmptyErrorMessage

Identifier of the error message shown when NotEmptyAttribute constraint is violated.

NotNullErrorMessage

Identifier of the error message shown when NotNullAttribute constraint is violated.

PhoneErrorMessage

Identifier of the error message shown when PhoneAttribute constraint is violated.

RangeErrorMessage

Identifier of the error message shown when RangeAttribute constraint is violated.

RegularExpressionErrorMessage

Identifier of the error message shown when RegularExpressionAttribute constraint is violated.

RequiredErrorMessage

Identifier of the error message shown when RequiredAttribute constraint is violated.

StrictRangeErrorMessage

Identifier of the error message shown when RangeAttribute constraint is violated.

StrictlyGreaterThanErrorMessage

Identifier of the error message shown when StrictlyGreaterThanAttribute constraint is violated.

StrictlyLessThanErrorMessage

Identifier of the error message shown when StrictlyLessThanAttribute constraint is violated.

StringLengthMaxErrorMessage

Identifier of the error message shown when StringLengthAttribute constraint is violated (only maximum length was specified).

StringLengthMinErrorMessage

Identifier of the error message shown when StringLengthAttribute constraint is violated (only minimum length was specified).

StringLengthRangeErrorMessage

Identifier of the error message shown when StringLengthAttribute constraint is violated (both minimum and maximum was specified).

UrlErrorMessage

Identifier of the error message shown when UrlAttribute constraint is violated.

Properties

Name Description
Current

Current instance of ContractLocalizedTextProvider.

Methods

Name Description
GetFormattedMessage(ContractExceptionInfo)

Gets a message template using GetMessage(string) and formats it using the values in exceptionInfo.

GetFormattingStringArguments(object, string, LocationKind, object[])

Returns an array of arguments that can be passed to the Format(string, params object[]) method

GetMessage(string)

Gets a message declared by the LocalizedTextProvider or the rest of responsibility chain if applicable.