MessageFormatter
Assists in the construction of validation messages.
Assembly: ServiceStack.dll
View Source
public class MessageFormatter
Properties
AdditionalArguments
Additional arguments to use
View Source
[Obsolete("AdditionalArguments will be removed in FluentValidation 10. Please construct your error message with a function instead.")]
public object[] AdditionalArguments { get; }
PlaceholderValues
Additional placeholder values
View Source
public Dictionary<string, object> PlaceholderValues { get; }
Fields
PropertyName
Default Property Name placeholder.
View Source
public const string PropertyName = "PropertyName"
PropertyValue
Default Property Value placeholder.
View Source
public const string PropertyValue = "PropertyValue"
Methods
AppendArgument(String, Object)
Adds a value for a validation message placeholder.
View Source
public MessageFormatter AppendArgument(string name, object value)
Returns
ServiceStack.FluentValidation.Internal.MessageFormatter
Parameters
Type | Name |
---|---|
System.String | name |
System.Object | value |
AppendPropertyName(String)
Appends a property name to the message.
View Source
public MessageFormatter AppendPropertyName(string name)
Returns
ServiceStack.FluentValidation.Internal.MessageFormatter
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the property |
|
AppendPropertyValue(Object)
Appends a property value to the message.
View Source
public MessageFormatter AppendPropertyValue(object value)
Returns
ServiceStack.FluentValidation.Internal.MessageFormatter
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The value of the property |
|
AppendAdditionalArguments(Object[])
Adds additional arguments to the message for use with standard string placeholders.
View Source
[Obsolete("AppendAdditionalArguments will be removed in FluentValidation 10. Please construct your error message with a function instead.")]
public MessageFormatter AppendAdditionalArguments(params object[] additionalArgs)
Returns
ServiceStack.FluentValidation.Internal.MessageFormatter
Parameters
Type | Name | Description |
---|---|---|
System.Object[] | additionalArgs | Additional arguments |
|
BuildMessage(String)
Constructs the final message from the specified template.
View Source
public virtual string BuildMessage(string messageTemplate)
Returns
System.String
: The message with placeholders replaced with their appropriate values
Parameters
Type | Name | Description |
---|---|---|
System.String | messageTemplate | Message template |
|
ReplacePlaceholdersWithValues(String, IDictionary<String, Object>)
View Source
protected virtual string ReplacePlaceholdersWithValues(string template, IDictionary<string, object> values)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | template |
System.Collections.Generic.IDictionary<System.String,System.Object> | values |