Skip to main content

MessageFormatter

Assists in the construction of validation messages.

Assembly: ServiceStack.dll
View Source
Declaration
public class MessageFormatter

Properties

AdditionalArguments

Additional arguments to use

View Source
Declaration
[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
Declaration
public Dictionary<string, object> PlaceholderValues { get; }

Fields

PropertyName

Default Property Name placeholder.

View Source
Declaration
public const string PropertyName = "PropertyName"

PropertyValue

Default Property Value placeholder.

View Source
Declaration
public const string PropertyValue = "PropertyValue"

Methods

AppendArgument(String, Object)

Adds a value for a validation message placeholder.

View Source
Declaration
public MessageFormatter AppendArgument(string name, object value)
Returns

ServiceStack.FluentValidation.Internal.MessageFormatter

Parameters
TypeName
System.Stringname
System.Objectvalue

AppendPropertyName(String)

Appends a property name to the message.

View Source
Declaration
public MessageFormatter AppendPropertyName(string name)
Returns

ServiceStack.FluentValidation.Internal.MessageFormatter

Parameters
TypeNameDescription
System.StringnameThe name of the property

|

AppendPropertyValue(Object)

Appends a property value to the message.

View Source
Declaration
public MessageFormatter AppendPropertyValue(object value)
Returns

ServiceStack.FluentValidation.Internal.MessageFormatter

Parameters
TypeNameDescription
System.ObjectvalueThe value of the property

|

AppendAdditionalArguments(Object[])

Adds additional arguments to the message for use with standard string placeholders.

View Source
Declaration
[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
TypeNameDescription
System.Object[]additionalArgsAdditional arguments

|

BuildMessage(String)

Constructs the final message from the specified template.

View Source
Declaration
public virtual string BuildMessage(string messageTemplate)
Returns

System.String: The message with placeholders replaced with their appropriate values

Parameters
TypeNameDescription
System.StringmessageTemplateMessage template

|

ReplacePlaceholdersWithValues(String, IDictionary<String, Object>)

View Source
Declaration
protected virtual string ReplacePlaceholdersWithValues(string template, IDictionary<string, object> values)
Returns

System.String

Parameters
TypeName
System.Stringtemplate
System.Collections.Generic.IDictionary<System.String,System.Object>values