Base class for contract error messages providers.
Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common.dll
Syntax
public class ContractLocalizedTextProvider : LocalizedTextProviderRemarks
An implementation would typically override the GetMessage(string) method. This method returns a formatting string where first 4 parameters have a well-known signification:
| Parameter | Description |
|---|---|
| {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. |