DefaultValidatorOptions
Default options that can be used to configure a validator.
Assembly: ServiceStack.dll
View Source
public static class DefaultValidatorOptions
Methods
Cascade<T, TProperty>(IRuleBuilderInitial<T, TProperty>, CascadeMode)
Specifies the cascade mode for failures. If set to 'Stop' then execution of the rule will stop once the first validator in the chain fails. If set to 'Continue' then all validators in the chain will execute regardless of failures.
View Source
public static IRuleBuilderInitial<T, TProperty> Cascade<T, TProperty>(this IRuleBuilderInitial<T, TProperty> ruleBuilder, CascadeMode cascadeMode)
Returns
ServiceStack.FluentValidation.IRuleBuilderInitial<<T>,<TProperty>>
Parameters
Type | Name |
---|---|
ServiceStack.FluentValidation.IRuleBuilderInitial<<T>,<TProperty>> | ruleBuilder |
ServiceStack.FluentValidation.CascadeMode | cascadeMode |
Type Parameters
T
TProperty
Cascade<T, TProperty>(IRuleBuilderInitialCollection<T, TProperty>, CascadeMode)
Specifies the cascade mode for failures. If set to 'Stop' then execution of the rule will stop once the first validator in the chain fails. If set to 'Continue' then all validators in the chain will execute regardless of failures.
View Source
public static IRuleBuilderInitialCollection<T, TProperty> Cascade<T, TProperty>(this IRuleBuilderInitialCollection<T, TProperty> ruleBuilder, CascadeMode cascadeMode)
Returns
ServiceStack.FluentValidation.IRuleBuilderInitialCollection<<T>,<TProperty>>
Parameters
Type | Name |
---|---|
ServiceStack.FluentValidation.IRuleBuilderInitialCollection<<T>,<TProperty>> | ruleBuilder |
ServiceStack.FluentValidation.CascadeMode | cascadeMode |
Type Parameters
T
TProperty
OnAnyFailure<T, TProperty>(IRuleBuilderOptions<T, TProperty>, Action<T>)
Specifies a custom action to be invoked when the validator fails.
View Source
public static IRuleBuilderOptions<T, TProperty> OnAnyFailure<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, Action<T> onFailure)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name |
---|---|
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>> | rule |
System.Action<<T>> | onFailure |
Type Parameters
T
TProperty
OnAnyFailure<T, TProperty>(IRuleBuilderOptions<T, TProperty>, Action<T, IEnumerable<ValidationFailure>>)
Specifies a custom action to be invoked when the validator fails.
View Source
public static IRuleBuilderOptions<T, TProperty> OnAnyFailure<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, Action<T, IEnumerable<ValidationFailure>> onFailure)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name |
---|---|
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>> | rule |
System.Action<<T>,System.Collections.Generic.IEnumerable<ServiceStack.FluentValidation.Results.ValidationFailure>> | onFailure |
Type Parameters
T
TProperty
WithMessage<T, TProperty>(IRuleBuilderOptions<T, TProperty>, String)
Specifies a custom error message to use when validation fails. Only applies to the rule that directly precedes it.
View Source
public static IRuleBuilderOptions<T, TProperty> WithMessage<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, string errorMessage)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>> | rule | The current rule |
|
| System.String
| errorMessage | The error message to use
|
Type Parameters
T
TProperty
WithMessage<T, TProperty>(IRuleBuilderOptions<T, TProperty>, Func<T, String>)
Specifies a custom error message to use when validation fails. Only applies to the rule that directly precedes it.
View Source
public static IRuleBuilderOptions<T, TProperty> WithMessage<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, Func<T, string> messageProvider)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>> | rule | The current rule |
|
| System.Func<<T>,System.String>
| messageProvider | Delegate that will be invoked to retrieve the localized message.
|
Type Parameters
T
TProperty
WithMessage<T, TProperty>(IRuleBuilderOptions<T, TProperty>, Func<T, TProperty, String>)
Specifies a custom error message to use when validation fails. Only applies to the rule that directly precedes it.
View Source
public static IRuleBuilderOptions<T, TProperty> WithMessage<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, Func<T, TProperty, string> messageProvider)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>> | rule | The current rule |
|
| System.Func<<T>,<TProperty>,System.String>
| messageProvider | Delegate that will be invoked.Uses_localized_name to retrieve the localized message.
|
Type Parameters
T
TProperty
WithErrorCode<T, TProperty>(IRuleBuilderOptions<T, TProperty>, String)
Specifies a custom error code to use if validation fails.
View Source
public static IRuleBuilderOptions<T, TProperty> WithErrorCode<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, string errorCode)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>> | rule | The current rule |
|
| System.String
| errorCode | The error code to use
|
Type Parameters
T
TProperty
When<T, TProperty>(IRuleBuilderOptions<T, TProperty>, Func<T, Boolean>, ApplyConditionTo)
Specifies a condition limiting when the validator should run. The validator will only be executed if the result of the lambda returns true.
View Source
public static IRuleBuilderOptions<T, TProperty> When<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, Func<T, bool> predicate, ApplyConditionTo applyConditionTo = ApplyConditionTo.AllValidators)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>> | rule | The current rule |
|
| System.Func<<T>,System.Boolean>
| predicate | A lambda expression that specifies a condition for when the validator should run
| | ServiceStack.FluentValidation.ApplyConditionTo | applyConditionTo | Whether the condition should be applied to the current rule or all rules in the chain
|
Type Parameters
T
TProperty
When<T, TProperty>(IRuleBuilderOptions<T, TProperty>, Func<T, ValidationContext<T>, Boolean>, ApplyConditionTo)
Specifies a condition limiting when the validator should run. The validator will only be executed if the result of the lambda returns true.
View Source
public static IRuleBuilderOptions<T, TProperty> When<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, Func<T, ValidationContext<T>, bool> predicate, ApplyConditionTo applyConditionTo = ApplyConditionTo.AllValidators)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>> | rule | The current rule |
|
| System.Func<<T>,ServiceStack.FluentValidation.ValidationContext<<T>>,System.Boolean>
| predicate | A lambda expression that specifies a condition for when the validator should run
| | ServiceStack.FluentValidation.ApplyConditionTo | applyConditionTo | Whether the condition should be applied to the current rule or all rules in the chain
|
Type Parameters
T
TProperty
Unless<T, TProperty>(IRuleBuilderOptions<T, TProperty>, Func<T, Boolean>, ApplyConditionTo)
Specifies a condition limiting when the validator should not run. The validator will only be executed if the result of the lambda returns false.
View Source
public static IRuleBuilderOptions<T, TProperty> Unless<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, Func<T, bool> predicate, ApplyConditionTo applyConditionTo = ApplyConditionTo.AllValidators)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>> | rule | The current rule |
|
| System.Func<<T>,System.Boolean>
| predicate | A lambda expression that specifies a condition for when the validator should not run
| | ServiceStack.FluentValidation.ApplyConditionTo | applyConditionTo | Whether the condition should be applied to the current rule or all rules in the chain
|
Type Parameters
T
TProperty
Unless<T, TProperty>(IRuleBuilderOptions<T, TProperty>, Func<T, ValidationContext<T>, Boolean>, ApplyConditionTo)
Specifies a condition limiting when the validator should not run. The validator will only be executed if the result of the lambda returns false.
View Source
public static IRuleBuilderOptions<T, TProperty> Unless<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, Func<T, ValidationContext<T>, bool> predicate, ApplyConditionTo applyConditionTo = ApplyConditionTo.AllValidators)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>> | rule | The current rule |
|
| System.Func<<T>,ServiceStack.FluentValidation.ValidationContext<<T>>,System.Boolean>
| predicate | A lambda expression that specifies a condition for when the validator should not run
| | ServiceStack.FluentValidation.ApplyConditionTo | applyConditionTo | Whether the condition should be applied to the current rule or all rules in the chain
|
Type Parameters
T
TProperty
WhenAsync<T, TProperty>(IRuleBuilderOptions<T, TProperty>, Func<T, CancellationToken, Task<Boolean>>, ApplyConditionTo)
Specifies an asynchronous condition limiting when the validator should run. The validator will only be executed if the result of the lambda returns true.
View Source
public static IRuleBuilderOptions<T, TProperty> WhenAsync<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, Func<T, CancellationToken, Task<bool>> predicate, ApplyConditionTo applyConditionTo = ApplyConditionTo.AllValidators)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>> | rule | The current rule |
|
| System.Func<<T>,System.Threading.CancellationToken,System.Threading.Tasks.Task<System.Boolean>>
| predicate | A lambda expression that specifies a condition for when the validator should run
| | ServiceStack.FluentValidation.ApplyConditionTo | applyConditionTo | Whether the condition should be applied to the current rule or all rules in the chain
|
Type Parameters
T
TProperty
WhenAsync<T, TProperty>(IRuleBuilderOptions<T, TProperty>, Func<T, ValidationContext<T>, CancellationToken, Task<Boolean>>, ApplyConditionTo)
Specifies an asynchronous condition limiting when the validator should run. The validator will only be executed if the result of the lambda returns true.
View Source
public static IRuleBuilderOptions<T, TProperty> WhenAsync<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, Func<T, ValidationContext<T>, CancellationToken, Task<bool>> predicate, ApplyConditionTo applyConditionTo = ApplyConditionTo.AllValidators)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>> | rule | The current rule |
|
| System.Func<<T>,ServiceStack.FluentValidation.ValidationContext<<T>>,System.Threading.CancellationToken,System.Threading.Tasks.Task<System.Boolean>>
| predicate | A lambda expression that specifies a condition for when the validator should run
| | ServiceStack.FluentValidation.ApplyConditionTo | applyConditionTo | Whether the condition should be applied to the current rule or all rules in the chain
|
Type Parameters
T
TProperty
UnlessAsync<T, TProperty>(IRuleBuilderOptions<T, TProperty>, Func<T, CancellationToken, Task<Boolean>>, ApplyConditionTo)
Specifies an asynchronous condition limiting when the validator should not run. The validator will only be executed if the result of the lambda returns false.
View Source
public static IRuleBuilderOptions<T, TProperty> UnlessAsync<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, Func<T, CancellationToken, Task<bool>> predicate, ApplyConditionTo applyConditionTo = ApplyConditionTo.AllValidators)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>> | rule | The current rule |
|
| System.Func<<T>,System.Threading.CancellationToken,System.Threading.Tasks.Task<System.Boolean>>
| predicate | A lambda expression that specifies a condition for when the validator should not run
| | ServiceStack.FluentValidation.ApplyConditionTo | applyConditionTo | Whether the condition should be applied to the current rule or all rules in the chain
|
Type Parameters
T
TProperty
UnlessAsync<T, TProperty>(IRuleBuilderOptions<T, TProperty>, Func<T, ValidationContext<T>, CancellationToken, Task<Boolean>>, ApplyConditionTo)
Specifies an asynchronous condition limiting when the validator should not run. The validator will only be executed if the result of the lambda returns false.
View Source
public static IRuleBuilderOptions<T, TProperty> UnlessAsync<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, Func<T, ValidationContext<T>, CancellationToken, Task<bool>> predicate, ApplyConditionTo applyConditionTo = ApplyConditionTo.AllValidators)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>> | rule | The current rule |
|
| System.Func<<T>,ServiceStack.FluentValidation.ValidationContext<<T>>,System.Threading.CancellationToken,System.Threading.Tasks.Task<System.Boolean>>
| predicate | A lambda expression that specifies a condition for when the validator should not run
| | ServiceStack.FluentValidation.ApplyConditionTo | applyConditionTo | Whether the condition should be applied to the current rule or all rules in the chain
|
Type Parameters
T
TProperty
Where<T, TCollectionElement>(IRuleBuilderInitialCollection<T, TCollectionElement>, Func<TCollectionElement, Boolean>)
Applies a filter to a collection property.
View Source
public static IRuleBuilderInitialCollection<T, TCollectionElement> Where<T, TCollectionElement>(this IRuleBuilderInitialCollection<T, TCollectionElement> rule, Func<TCollectionElement, bool> predicate)
Returns
ServiceStack.FluentValidation.IRuleBuilderInitialCollection<<T>,<TCollectionElement>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilderInitialCollection<<T>,<TCollectionElement>> | rule | The current rule |
|
| System.Func<<TCollectionElement>,System.Boolean>
| predicate | The condition
|
Type Parameters
T
TCollectionElement
DependentRules<T, TProperty>(IRuleBuilderOptions<T, TProperty>, Action)
Triggers an action when the rule passes. Typically used to configure dependent rules. This applies to all preceding rules in the chain.
View Source
public static IRuleBuilderOptions<T, TProperty> DependentRules<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, Action action)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>> | rule | The current rule |
|
| System.Action
| action | An action to be invoked if the rule is valid
|
Type Parameters
T
TProperty
WithName<T, TProperty>(IRuleBuilderOptions<T, TProperty>, String)
Specifies a custom property name to use within the error message.
View Source
public static IRuleBuilderOptions<T, TProperty> WithName<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, string overridePropertyName)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>> | rule | The current rule |
|
| System.String
| overridePropertyName | The property name to use
|
Type Parameters
T
TProperty
WithName<T, TProperty>(IRuleBuilderOptions<T, TProperty>, Func<T, String>)
Specifies a custom property name to use within the error message.
View Source
public static IRuleBuilderOptions<T, TProperty> WithName<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, Func<T, string> nameProvider)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>> | rule | The current rule |
|
| System.Func<<T>,System.String>
| nameProvider | Func used to retrieve the property's display name
|
Type Parameters
T
TProperty
OverridePropertyName<T, TProperty>(IRuleBuilderOptions<T, TProperty>, String)
Overrides the name of the property associated with this rule. NOTE: This is a considered to be an advanced feature. Most of the time that you use this, you actually meant to use WithName.
View Source
public static IRuleBuilderOptions<T, TProperty> OverridePropertyName<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, string propertyName)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>> | rule | The current rule |
|
| System.String
| propertyName | The property name to use
|
Type Parameters
T
TProperty
OverridePropertyName<T, TProperty>(IRuleBuilderOptions<T, TProperty>, Expression<Func<T, Object>>)
Overrides the name of the property associated with this rule. NOTE: This is a considered to be an advanced feature. Most of the time that you use this, you actually meant to use WithName.
View Source
public static IRuleBuilderOptions<T, TProperty> OverridePropertyName<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, Expression<Func<T, object>> expr)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>> | rule | The current rule |
|
| System.Linq.Expressions.Expression<System.Func<<T>,System.Object>>
| expr | An expression referencing another property
|
Type Parameters
T
TProperty
WithState<T, TProperty>(IRuleBuilderOptions<T, TProperty>, Func<T, Object>)
Specifies custom state that should be stored alongside the validation message when validation fails for this rule.
View Source
public static IRuleBuilderOptions<T, TProperty> WithState<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, Func<T, object> stateProvider)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name |
---|---|
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>> | rule |
System.Func<<T>,System.Object> | stateProvider |
Type Parameters
T
TProperty
WithState<T, TProperty>(IRuleBuilderOptions<T, TProperty>, Func<T, TProperty, Object>)
Specifies custom state that should be stored alongside the validation message when validation fails for this rule.
View Source
public static IRuleBuilderOptions<T, TProperty> WithState<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, Func<T, TProperty, object> stateProvider)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name |
---|---|
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>> | rule |
System.Func<<T>,<TProperty>,System.Object> | stateProvider |
Type Parameters
T
TProperty
WithSeverity<T, TProperty>(IRuleBuilderOptions<T, TProperty>, Severity)
Specifies custom severity that should be stored alongside the validation message when validation fails for this rule.
View Source
public static IRuleBuilderOptions<T, TProperty> WithSeverity<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, Severity severity)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name |
---|---|
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>> | rule |
ServiceStack.FluentValidation.Severity | severity |
Type Parameters
T
TProperty
WithSeverity<T, TProperty>(IRuleBuilderOptions<T, TProperty>, Func<T, Severity>)
Specifies custom severity that should be stored alongside the validation message when validation fails for this rule.
View Source
public static IRuleBuilderOptions<T, TProperty> WithSeverity<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, Func<T, Severity> severityProvider)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name |
---|---|
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>> | rule |
System.Func<<T>,ServiceStack.FluentValidation.Severity> | severityProvider |
Type Parameters
T
TProperty
WithSeverity<T, TProperty>(IRuleBuilderOptions<T, TProperty>, Func<T, TProperty, Severity>)
Specifies custom severity that should be stored alongside the validation message when validation fails for this rule.
View Source
public static IRuleBuilderOptions<T, TProperty> WithSeverity<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, Func<T, TProperty, Severity> severityProvider)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name |
---|---|
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>> | rule |
System.Func<<T>,<TProperty>,ServiceStack.FluentValidation.Severity> | severityProvider |
Type Parameters
T
TProperty
OnFailure<T, TProperty>(IRuleBuilderOptions<T, TProperty>, Action<T>)
Specifies custom method that will be called when specific rule fails
View Source
public static IRuleBuilderOptions<T, TProperty> OnFailure<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, Action<T> onFailure)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name |
---|---|
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>> | rule |
System.Action<<T>> | onFailure |
Type Parameters
T
TProperty
OnFailure<T, TProperty>(IRuleBuilderOptions<T, TProperty>, Action<T, PropertyValidatorContext>)
Specifies custom method that will be called when specific rule fails
View Source
public static IRuleBuilderOptions<T, TProperty> OnFailure<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, Action<T, PropertyValidatorContext> onFailure)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name |
---|---|
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>> | rule |
System.Action<<T>,ServiceStack.FluentValidation.Validators.PropertyValidatorContext> | onFailure |
Type Parameters
T
TProperty
OnFailure<T, TProperty>(IRuleBuilderOptions<T, TProperty>, Action<T, PropertyValidatorContext, String>)
Specifies custom method that will be called when specific rule fails
View Source
public static IRuleBuilderOptions<T, TProperty> OnFailure<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, Action<T, PropertyValidatorContext, string> onFailure)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name |
---|---|
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>> | rule |
System.Action<<T>,ServiceStack.FluentValidation.Validators.PropertyValidatorContext,System.String> | onFailure |
Type Parameters
T
TProperty
OverrideIndexer<T, TCollectionElement>(IRuleBuilderInitialCollection<T, TCollectionElement>, Func<T, IEnumerable<TCollectionElement>, TCollectionElement, Int32, String>)
Allows the generated indexer to be overridden for collection rules.
View Source
public static IRuleBuilderInitialCollection<T, TCollectionElement> OverrideIndexer<T, TCollectionElement>(this IRuleBuilderInitialCollection<T, TCollectionElement> rule, Func<T, IEnumerable<TCollectionElement>, TCollectionElement, int, string> callback)
Returns
ServiceStack.FluentValidation.IRuleBuilderInitialCollection<<T>,<TCollectionElement>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilderInitialCollection<<T>,<TCollectionElement>> | rule | The current rule |
|
| System.Func<<T>,System.Collections.Generic.IEnumerable<<TCollectionElement>>,<TCollectionElement>,System.Int32,System.String>
| callback | The callback. Receives the model, the collection, the current element and the current index as parameters. Should return a string representation of the indexer. The default is "[" + index + "]"
|
Type Parameters
T
TCollectionElement
GetStringForValidator<T>(ILanguageManager)
Gets the default message for a property validator
View Source
public static string GetStringForValidator<T>(this ILanguageManager languageManager)
Returns
System.String
: The translated string
Parameters
Type | Name |
---|---|
ServiceStack.FluentValidation.Resources.ILanguageManager | languageManager |
Type Parameters
Name | Description |
---|---|
T | The validator type |