DefaultValidatorExtensions
Extension methods that provide the default set of validators.
Assembly: ServiceStack.dll
View Source
public static class DefaultValidatorExtensions
Methods
NotNull<T, TProperty>(IRuleBuilder<T, TProperty>)
Defines a 'not null' validator on the current rule builder. Validation will fail if the property is null.
View Source
public static IRuleBuilderOptions<T, TProperty> NotNull<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder | The rule builder on which the validator should be defined |
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
Null<T, TProperty>(IRuleBuilder<T, TProperty>)
Defines a 'null' validator on the current rule builder. Validation will fail if the property is not null.
View Source
public static IRuleBuilderOptions<T, TProperty> Null<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder | The rule builder on which the validator should be defined |
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
NotEmpty<T, TProperty>(IRuleBuilder<T, TProperty>)
Defines a 'not empty' validator on the current rule builder. Validation will fail if the property is null, an empty string, whitespace, an empty collection or the default value for the type (for example, 0 for integers but null for nullable integers)
View Source
public static IRuleBuilderOptions<T, TProperty> NotEmpty<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder | The rule builder on which the validator should be defined |
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
Empty<T, TProperty>(IRuleBuilder<T, TProperty>)
Defines a 'empty' validator on the current rule builder. Validation will fail if the property is not null, an empty or the default value for the type (for example, 0 for integers)
View Source
public static IRuleBuilderOptions<T, TProperty> Empty<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder | The rule builder on which the validator should be defined |
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
Length<T>(IRuleBuilder<T, String>, Int32, Int32)
Defines a length validator on the current rule builder, but only for string properties. Validation will fail if the length of the string is outside of the specified range. The range is inclusive.
View Source
public static IRuleBuilderOptions<T, string> Length<T>(this IRuleBuilder<T, string> ruleBuilder, int min, int max)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,System.String>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,System.String> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Int32
| min |
|
| System.Int32
| max |
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
Length<T>(IRuleBuilder<T, String>, Func<T, Int32>, Func<T, Int32>)
Defines a length validator on the current rule builder, but only for string properties. Validation will fail if the length of the string is outside of the specified range. The range is inclusive.
View Source
public static IRuleBuilderOptions<T, string> Length<T>(this IRuleBuilder<T, string> ruleBuilder, Func<T, int> min, Func<T, int> max)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,System.String>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,System.String> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Func<<T>,System.Int32>
| min |
|
| System.Func<<T>,System.Int32>
| max |
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
Length<T>(IRuleBuilder<T, String>, Int32)
Defines a length validator on the current rule builder, but only for string properties. Validation will fail if the length of the string is not equal to the length specified.
View Source
public static IRuleBuilderOptions<T, string> Length<T>(this IRuleBuilder<T, string> ruleBuilder, int exactLength)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,System.String>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,System.String> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Int32
| exactLength |
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
Length<T>(IRuleBuilder<T, String>, Func<T, Int32>)
Defines a length validator on the current rule builder, but only for string properties. Validation will fail if the length of the string is not equal to the length specified.
View Source
public static IRuleBuilderOptions<T, string> Length<T>(this IRuleBuilder<T, string> ruleBuilder, Func<T, int> exactLength)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,System.String>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,System.String> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Func<<T>,System.Int32>
| exactLength |
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
Matches<T>(IRuleBuilder<T, String>, String)
Defines a regular expression validator on the current rule builder, but only for string properties. Validation will fail if the value returned by the lambda does not match the regular expression.
View Source
public static IRuleBuilderOptions<T, string> Matches<T>(this IRuleBuilder<T, string> ruleBuilder, string expression)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,System.String>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,System.String> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.String
| expression | The regular expression to check the value against.
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
MaximumLength<T>(IRuleBuilder<T, String>, Int32)
Defines a length validator on the current rule builder, but only for string properties. Validation will fail if the length of the string is larger than the length specified.
View Source
public static IRuleBuilderOptions<T, string> MaximumLength<T>(this IRuleBuilder<T, string> ruleBuilder, int maximumLength)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,System.String>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,System.String> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Int32
| maximumLength |
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
MinimumLength<T>(IRuleBuilder<T, String>, Int32)
Defines a length validator on the current rule builder, but only for string properties. Validation will fail if the length of the string is less than the length specified.
View Source
public static IRuleBuilderOptions<T, string> MinimumLength<T>(this IRuleBuilder<T, string> ruleBuilder, int minimumLength)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,System.String>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,System.String> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Int32
| minimumLength |
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
Matches<T>(IRuleBuilder<T, String>, Func<T, String>)
Defines a regular expression validator on the current rule builder, but only for string properties. Validation will fail if the value returned by the lambda does not match the regular expression.
View Source
public static IRuleBuilderOptions<T, string> Matches<T>(this IRuleBuilder<T, string> ruleBuilder, Func<T, string> expression)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,System.String>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,System.String> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Func<<T>,System.String>
| expression | The regular expression to check the value against.
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
Matches<T>(IRuleBuilder<T, String>, Regex)
Defines a regular expression validator on the current rule builder, but only for string properties. Validation will fail if the value returned by the lambda does not match the regular expression.
View Source
public static IRuleBuilderOptions<T, string> Matches<T>(this IRuleBuilder<T, string> ruleBuilder, Regex regex)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,System.String>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,System.String> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Text.RegularExpressions.Regex
| regex | The regular expression to use
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
Matches<T>(IRuleBuilder<T, String>, Func<T, Regex>)
Defines a regular expression validator on the current rule builder, but only for string properties. Validation will fail if the value returned by the lambda does not match the regular expression.
View Source
public static IRuleBuilderOptions<T, string> Matches<T>(this IRuleBuilder<T, string> ruleBuilder, Func<T, Regex> regex)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,System.String>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,System.String> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Func<<T>,System.Text.RegularExpressions.Regex>
| regex | The regular expression to use
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
Matches<T>(IRuleBuilder<T, String>, String, RegexOptions)
Defines a regular expression validator on the current rule builder, but only for string properties. Validation will fail if the value returned by the lambda does not match the regular expression.
View Source
public static IRuleBuilderOptions<T, string> Matches<T>(this IRuleBuilder<T, string> ruleBuilder, string expression, RegexOptions options)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,System.String>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,System.String> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.String
| expression | The regular expression to check the value against.
|
| System.Text.RegularExpressions.RegexOptions
| options | Regex options
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
Matches<T>(IRuleBuilder<T, String>, Func<T, String>, RegexOptions)
Defines a regular expression validator on the current rule builder, but only for string properties. Validation will fail if the value returned by the lambda does not match the regular expression.
View Source
public static IRuleBuilderOptions<T, string> Matches<T>(this IRuleBuilder<T, string> ruleBuilder, Func<T, string> expression, RegexOptions options)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,System.String>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,System.String> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Func<<T>,System.String>
| expression | The regular expression to check the value against.
|
| System.Text.RegularExpressions.RegexOptions
| options | Regex options
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
EmailAddress<T>(IRuleBuilder<T, String>, EmailValidationMode)
Defines an email validator on the current rule builder for string properties. Validation will fail if the value returned by the lambda is not a valid email address.
View Source
public static IRuleBuilderOptions<T, string> EmailAddress<T>(this IRuleBuilder<T, string> ruleBuilder, EmailValidationMode mode = EmailValidationMode.AspNetCoreCompatible)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,System.String>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,System.String> | ruleBuilder | The rule builder on which the validator should be defined |
| | ServiceStack.FluentValidation.Validators.EmailValidationMode | mode | The mode to use for email validation. If set to ServiceStack.FluentValidation.Validators.EmailValidationMode.Net4xRegex, then a regular expression will be used. This is the same regex used by the EmailAddressAttribute in .NET 4.x. If set to ServiceStack.FluentValidation.Validators.EmailValidationMode.AspNetCoreCompatible then this uses the simplified ASP.NET Core logic for checking an email address, which just checks for the presence of an @ sign.
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
NotEqual<T, TProperty>(IRuleBuilder<T, TProperty>, TProperty, IEqualityComparer)
Defines a 'not equal' validator on the current rule builder. Validation will fail if the specified value is equal to the value of the property. For strings, this performs an ordinal comparison unless you specify a different comparer.
View Source
public static IRuleBuilderOptions<T, TProperty> NotEqual<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder, TProperty toCompare, IEqualityComparer comparer = null)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| <TProperty>
| toCompare | The value to compare
|
| System.Collections.IEqualityComparer
| comparer | Equality comparer to use
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
NotEqual<T, TProperty>(IRuleBuilder<T, TProperty>, Expression<Func<T, TProperty>>, IEqualityComparer)
Defines a 'not equal' validator on the current rule builder using a lambda to specify the value. Validation will fail if the value returned by the lambda is equal to the value of the property. For strings, this performs an ordinal comparison unless you specify a different comparer.
View Source
public static IRuleBuilderOptions<T, TProperty> NotEqual<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder, Expression<Func<T, TProperty>> expression, IEqualityComparer comparer = null)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Linq.Expressions.Expression<System.Func<<T>,<TProperty>>>
| expression | A lambda expression to provide the comparison value
|
| System.Collections.IEqualityComparer
| comparer | Equality Comparer to use
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
Equal<T, TProperty>(IRuleBuilder<T, TProperty>, TProperty, IEqualityComparer)
Defines an 'equals' validator on the current rule builder. Validation will fail if the specified value is not equal to the value of the property. For strings, this performs an ordinal comparison unless you specify a different comparer.
View Source
public static IRuleBuilderOptions<T, TProperty> Equal<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder, TProperty toCompare, IEqualityComparer comparer = null)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| <TProperty>
| toCompare | The value to compare
|
| System.Collections.IEqualityComparer
| comparer | Equality Comparer to use
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
Equal<T, TProperty>(IRuleBuilder<T, TProperty>, Expression<Func<T, TProperty>>, IEqualityComparer)
Defines an 'equals' validator on the current rule builder using a lambda to specify the comparison value. Validation will fail if the value returned by the lambda is not equal to the value of the property. For strings, this performs an ordinal comparison unless you specify a different comparer.
View Source
public static IRuleBuilderOptions<T, TProperty> Equal<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder, Expression<Func<T, TProperty>> expression, IEqualityComparer comparer = null)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Linq.Expressions.Expression<System.Func<<T>,<TProperty>>>
| expression | A lambda expression to provide the comparison value
|
| System.Collections.IEqualityComparer
| comparer | Equality comparer to use
|
Type Parameters
Name | Description |
---|---|
T | The type of object being validated |
TProperty | Type of property being validated |
Must<T, TProperty>(IRuleBuilder<T, TProperty>, Func<TProperty, Boolean>)
Defines a predicate validator on the current rule builder using a lambda expression to specify the predicate. Validation will fail if the specified lambda returns false. Validation will succeed if the specified lambda returns true.
View Source
public static IRuleBuilderOptions<T, TProperty> Must<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder, Func<TProperty, bool> predicate)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Func<<TProperty>,System.Boolean>
| predicate | A lambda expression specifying the predicate
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
Must<T, TProperty>(IRuleBuilder<T, TProperty>, Func<T, TProperty, Boolean>)
Defines a predicate validator on the current rule builder using a lambda expression to specify the predicate. Validation will fail if the specified lambda returns false. Validation will succeed if the specified lambda returns true. This overload accepts the object being validated in addition to the property being validated.
View Source
public static IRuleBuilderOptions<T, TProperty> Must<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder, Func<T, TProperty, bool> predicate)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Func<<T>,<TProperty>,System.Boolean>
| predicate | A lambda expression specifying the predicate
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
Must<T, TProperty>(IRuleBuilder<T, TProperty>, Func<T, TProperty, PropertyValidatorContext, Boolean>)
Defines a predicate validator on the current rule builder using a lambda expression to specify the predicate. Validation will fail if the specified lambda returns false. Validation will succeed if the specified lambda returns true. This overload accepts the object being validated in addition to the property being validated.
View Source
public static IRuleBuilderOptions<T, TProperty> Must<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder, Func<T, TProperty, PropertyValidatorContext, bool> predicate)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Func<<T>,<TProperty>,ServiceStack.FluentValidation.Validators.PropertyValidatorContext,System.Boolean>
| predicate | A lambda expression specifying the predicate
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
MustAsync<T, TProperty>(IRuleBuilder<T, TProperty>, Func<TProperty, CancellationToken, Task<Boolean>>)
Defines an asynchronous predicate validator on the current rule builder using a lambda expression to specify the predicate. Validation will fail if the specified lambda returns false. Validation will succeed if the specified lambda returns true.
View Source
public static IRuleBuilderOptions<T, TProperty> MustAsync<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder, Func<TProperty, CancellationToken, Task<bool>> predicate)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Func<<TProperty>,System.Threading.CancellationToken,System.Threading.Tasks.Task<System.Boolean>>
| predicate | A lambda expression specifying the predicate
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
MustAsync<T, TProperty>(IRuleBuilder<T, TProperty>, Func<T, TProperty, CancellationToken, Task<Boolean>>)
Defines an asynchronous predicate validator on the current rule builder using a lambda expression to specify the predicate. Validation will fail if the specified lambda returns false. Validation will succeed if the specified lambda returns true. This overload accepts the object being validated in addition to the property being validated.
View Source
public static IRuleBuilderOptions<T, TProperty> MustAsync<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder, Func<T, TProperty, CancellationToken, Task<bool>> predicate)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Func<<T>,<TProperty>,System.Threading.CancellationToken,System.Threading.Tasks.Task<System.Boolean>>
| predicate | A lambda expression specifying the predicate
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
MustAsync<T, TProperty>(IRuleBuilder<T, TProperty>, Func<T, TProperty, PropertyValidatorContext, CancellationToken, Task<Boolean>>)
Defines an asynchronous predicate validator on the current rule builder using a lambda expression to specify the predicate. Validation will fail if the specified lambda returns false. Validation will succeed if the specified lambda returns true. This overload accepts the object being validated in addition to the property being validated.
View Source
public static IRuleBuilderOptions<T, TProperty> MustAsync<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder, Func<T, TProperty, PropertyValidatorContext, CancellationToken, Task<bool>> predicate)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Func<<T>,<TProperty>,ServiceStack.FluentValidation.Validators.PropertyValidatorContext,System.Threading.CancellationToken,System.Threading.Tasks.Task<System.Boolean>>
| predicate | A lambda expression specifying the predicate
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
LessThan<T, TProperty>(IRuleBuilder<T, TProperty>, TProperty)
Defines a 'less than' validator on the current rule builder. The validation will succeed if the property value is less than the specified value. The validation will fail if the property value is greater than or equal to the specified value.
View Source
public static IRuleBuilderOptions<T, TProperty> LessThan<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder, TProperty valueToCompare)
where TProperty : IComparable<TProperty>, IComparable
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| <TProperty>
| valueToCompare | The value being compared
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
LessThan<T, TProperty>(IRuleBuilder<T, Nullable<TProperty>>, TProperty)
Defines a 'less than' validator on the current rule builder. The validation will succeed if the property value is less than the specified value. The validation will fail if the property value is greater than or equal to the specified value.
View Source
public static IRuleBuilderOptions<T, TProperty?> LessThan<T, TProperty>(this IRuleBuilder<T, TProperty?> ruleBuilder, TProperty valueToCompare)
where TProperty : struct, IComparable<TProperty>, IComparable
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,System.Nullable<<TProperty>>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,System.Nullable<<TProperty>>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| <TProperty>
| valueToCompare | The value being compared
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
LessThanOrEqualTo<T, TProperty>(IRuleBuilder<T, TProperty>, TProperty)
Defines a 'less than or equal' validator on the current rule builder. The validation will succeed if the property value is less than or equal to the specified value. The validation will fail if the property value is greater than the specified value.
View Source
public static IRuleBuilderOptions<T, TProperty> LessThanOrEqualTo<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder, TProperty valueToCompare)
where TProperty : IComparable<TProperty>, IComparable
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| <TProperty>
| valueToCompare | The value being compared
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
LessThanOrEqualTo<T, TProperty>(IRuleBuilder<T, Nullable<TProperty>>, TProperty)
Defines a 'less than or equal' validator on the current rule builder. The validation will succeed if the property value is less than or equal to the specified value. The validation will fail if the property value is greater than the specified value.
View Source
public static IRuleBuilderOptions<T, TProperty?> LessThanOrEqualTo<T, TProperty>(this IRuleBuilder<T, TProperty?> ruleBuilder, TProperty valueToCompare)
where TProperty : struct, IComparable<TProperty>, IComparable
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,System.Nullable<<TProperty>>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,System.Nullable<<TProperty>>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| <TProperty>
| valueToCompare | The value being compared
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
GreaterThan<T, TProperty>(IRuleBuilder<T, TProperty>, TProperty)
Defines a 'greater than' validator on the current rule builder. The validation will succeed if the property value is greater than the specified value. The validation will fail if the property value is less than or equal to the specified value.
View Source
public static IRuleBuilderOptions<T, TProperty> GreaterThan<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder, TProperty valueToCompare)
where TProperty : IComparable<TProperty>, IComparable
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| <TProperty>
| valueToCompare | The value being compared
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
GreaterThan<T, TProperty>(IRuleBuilder<T, Nullable<TProperty>>, TProperty)
Defines a 'greater than' validator on the current rule builder. The validation will succeed if the property value is greater than the specified value. The validation will fail if the property value is less than or equal to the specified value.
View Source
public static IRuleBuilderOptions<T, TProperty?> GreaterThan<T, TProperty>(this IRuleBuilder<T, TProperty?> ruleBuilder, TProperty valueToCompare)
where TProperty : struct, IComparable<TProperty>, IComparable
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,System.Nullable<<TProperty>>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,System.Nullable<<TProperty>>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| <TProperty>
| valueToCompare | The value being compared
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
GreaterThanOrEqualTo<T, TProperty>(IRuleBuilder<T, TProperty>, TProperty)
Defines a 'greater than or equal' validator on the current rule builder. The validation will succeed if the property value is greater than or equal the specified value. The validation will fail if the property value is less than the specified value.
View Source
public static IRuleBuilderOptions<T, TProperty> GreaterThanOrEqualTo<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder, TProperty valueToCompare)
where TProperty : IComparable<TProperty>, IComparable
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| <TProperty>
| valueToCompare | The value being compared
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
GreaterThanOrEqualTo<T, TProperty>(IRuleBuilder<T, Nullable<TProperty>>, TProperty)
Defines a 'greater than or equal' validator on the current rule builder. The validation will succeed if the property value is greater than or equal the specified value. The validation will fail if the property value is less than the specified value.
View Source
public static IRuleBuilderOptions<T, TProperty?> GreaterThanOrEqualTo<T, TProperty>(this IRuleBuilder<T, TProperty?> ruleBuilder, TProperty valueToCompare)
where TProperty : struct, IComparable<TProperty>, IComparable
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,System.Nullable<<TProperty>>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,System.Nullable<<TProperty>>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| <TProperty>
| valueToCompare | The value being compared
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
LessThan<T, TProperty>(IRuleBuilder<T, TProperty>, Expression<Func<T, TProperty>>)
Defines a 'less than' validator on the current rule builder using a lambda expression. The validation will succeed if the property value is less than the specified value. The validation will fail if the property value is greater than or equal to the specified value.
View Source
public static IRuleBuilderOptions<T, TProperty> LessThan<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder, Expression<Func<T, TProperty>> expression)
where TProperty : IComparable<TProperty>, IComparable
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Linq.Expressions.Expression<System.Func<<T>,<TProperty>>>
| expression | A lambda that should return the value being compared
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
LessThan<T, TProperty>(IRuleBuilder<T, TProperty>, Expression<Func<T, Nullable<TProperty>>>)
Defines a 'less than' validator on the current rule builder using a lambda expression. The validation will succeed if the property value is less than the specified value. The validation will fail if the property value is greater than or equal to the specified value.
View Source
public static IRuleBuilderOptions<T, TProperty> LessThan<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder, Expression<Func<T, TProperty?>> expression)
where TProperty : struct, IComparable<TProperty>, IComparable
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Linq.Expressions.Expression<System.Func<<T>,System.Nullable<<TProperty>>>>
| expression | A lambda that should return the value being compared
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
LessThan<T, TProperty>(IRuleBuilder<T, Nullable<TProperty>>, Expression<Func<T, TProperty>>)
Defines a 'less than' validator on the current rule builder using a lambda expression. The validation will succeed if the property value is less than the specified value. The validation will fail if the property value is greater than or equal to the specified value.
View Source
public static IRuleBuilderOptions<T, TProperty?> LessThan<T, TProperty>(this IRuleBuilder<T, TProperty?> ruleBuilder, Expression<Func<T, TProperty>> expression)
where TProperty : struct, IComparable<TProperty>, IComparable
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,System.Nullable<<TProperty>>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,System.Nullable<<TProperty>>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Linq.Expressions.Expression<System.Func<<T>,<TProperty>>>
| expression | A lambda that should return the value being compared
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
LessThan<T, TProperty>(IRuleBuilder<T, Nullable<TProperty>>, Expression<Func<T, Nullable<TProperty>>>)
Defines a 'less than' validator on the current rule builder using a lambda expression. The validation will succeed if the property value is less than the specified value. The validation will fail if the property value is greater than or equal to the specified value.
View Source
public static IRuleBuilderOptions<T, TProperty?> LessThan<T, TProperty>(this IRuleBuilder<T, TProperty?> ruleBuilder, Expression<Func<T, TProperty?>> expression)
where TProperty : struct, IComparable<TProperty>, IComparable
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,System.Nullable<<TProperty>>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,System.Nullable<<TProperty>>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Linq.Expressions.Expression<System.Func<<T>,System.Nullable<<TProperty>>>>
| expression | A lambda that should return the value being compared
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
LessThanOrEqualTo<T, TProperty>(IRuleBuilder<T, TProperty>, Expression<Func<T, TProperty>>)
Defines a 'less than or equal' validator on the current rule builder using a lambda expression. The validation will succeed if the property value is less than or equal to the specified value. The validation will fail if the property value is greater than the specified value.
View Source
public static IRuleBuilderOptions<T, TProperty> LessThanOrEqualTo<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder, Expression<Func<T, TProperty>> expression)
where TProperty : IComparable<TProperty>, IComparable
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Linq.Expressions.Expression<System.Func<<T>,<TProperty>>>
| expression | The value being compared
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
LessThanOrEqualTo<T, TProperty>(IRuleBuilder<T, TProperty>, Expression<Func<T, Nullable<TProperty>>>)
Defines a 'less than or equal' validator on the current rule builder using a lambda expression. The validation will succeed if the property value is less than or equal to the specified value. The validation will fail if the property value is greater than the specified value.
View Source
public static IRuleBuilderOptions<T, TProperty> LessThanOrEqualTo<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder, Expression<Func<T, TProperty?>> expression)
where TProperty : struct, IComparable<TProperty>, IComparable
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Linq.Expressions.Expression<System.Func<<T>,System.Nullable<<TProperty>>>>
| expression | The value being compared
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
LessThanOrEqualTo<T, TProperty>(IRuleBuilder<T, Nullable<TProperty>>, Expression<Func<T, TProperty>>)
Defines a 'less than or equal' validator on the current rule builder using a lambda expression. The validation will succeed if the property value is less than or equal to the specified value. The validation will fail if the property value is greater than the specified value.
View Source
public static IRuleBuilderOptions<T, TProperty?> LessThanOrEqualTo<T, TProperty>(this IRuleBuilder<T, TProperty?> ruleBuilder, Expression<Func<T, TProperty>> expression)
where TProperty : struct, IComparable<TProperty>, IComparable
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,System.Nullable<<TProperty>>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,System.Nullable<<TProperty>>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Linq.Expressions.Expression<System.Func<<T>,<TProperty>>>
| expression | The value being compared
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
LessThanOrEqualTo<T, TProperty>(IRuleBuilder<T, Nullable<TProperty>>, Expression<Func<T, Nullable<TProperty>>>)
Defines a 'less than or equal' validator on the current rule builder using a lambda expression. The validation will succeed if the property value is less than or equal to the specified value. The validation will fail if the property value is greater than the specified value.
View Source
public static IRuleBuilderOptions<T, TProperty?> LessThanOrEqualTo<T, TProperty>(this IRuleBuilder<T, TProperty?> ruleBuilder, Expression<Func<T, TProperty?>> expression)
where TProperty : struct, IComparable<TProperty>, IComparable
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,System.Nullable<<TProperty>>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,System.Nullable<<TProperty>>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Linq.Expressions.Expression<System.Func<<T>,System.Nullable<<TProperty>>>>
| expression | The value being compared
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
GreaterThan<T, TProperty>(IRuleBuilder<T, TProperty>, Expression<Func<T, TProperty>>)
Defines a 'less than' validator on the current rule builder using a lambda expression. The validation will succeed if the property value is greater than the specified value. The validation will fail if the property value is less than or equal to the specified value.
View Source
public static IRuleBuilderOptions<T, TProperty> GreaterThan<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder, Expression<Func<T, TProperty>> expression)
where TProperty : IComparable<TProperty>, IComparable
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Linq.Expressions.Expression<System.Func<<T>,<TProperty>>>
| expression | The value being compared
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
GreaterThan<T, TProperty>(IRuleBuilder<T, TProperty>, Expression<Func<T, Nullable<TProperty>>>)
Defines a 'less than' validator on the current rule builder using a lambda expression. The validation will succeed if the property value is greater than the specified value. The validation will fail if the property value is less than or equal to the specified value.
View Source
public static IRuleBuilderOptions<T, TProperty> GreaterThan<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder, Expression<Func<T, TProperty?>> expression)
where TProperty : struct, IComparable<TProperty>, IComparable
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Linq.Expressions.Expression<System.Func<<T>,System.Nullable<<TProperty>>>>
| expression | The value being compared
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
GreaterThan<T, TProperty>(IRuleBuilder<T, Nullable<TProperty>>, Expression<Func<T, TProperty>>)
Defines a 'less than' validator on the current rule builder using a lambda expression. The validation will succeed if the property value is greater than the specified value. The validation will fail if the property value is less than or equal to the specified value.
View Source
public static IRuleBuilderOptions<T, TProperty?> GreaterThan<T, TProperty>(this IRuleBuilder<T, TProperty?> ruleBuilder, Expression<Func<T, TProperty>> expression)
where TProperty : struct, IComparable<TProperty>, IComparable
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,System.Nullable<<TProperty>>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,System.Nullable<<TProperty>>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Linq.Expressions.Expression<System.Func<<T>,<TProperty>>>
| expression | The value being compared
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
GreaterThan<T, TProperty>(IRuleBuilder<T, Nullable<TProperty>>, Expression<Func<T, Nullable<TProperty>>>)
Defines a 'less than' validator on the current rule builder using a lambda expression. The validation will succeed if the property value is greater than the specified value. The validation will fail if the property value is less than or equal to the specified value.
View Source
public static IRuleBuilderOptions<T, TProperty?> GreaterThan<T, TProperty>(this IRuleBuilder<T, TProperty?> ruleBuilder, Expression<Func<T, TProperty?>> expression)
where TProperty : struct, IComparable<TProperty>, IComparable
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,System.Nullable<<TProperty>>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,System.Nullable<<TProperty>>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Linq.Expressions.Expression<System.Func<<T>,System.Nullable<<TProperty>>>>
| expression | The value being compared
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
GreaterThanOrEqualTo<T, TProperty>(IRuleBuilder<T, TProperty>, Expression<Func<T, TProperty>>)
Defines a 'greater than' validator on the current rule builder using a lambda expression. The validation will succeed if the property value is greater than or equal the specified value. The validation will fail if the property value is less than the specified value.
View Source
public static IRuleBuilderOptions<T, TProperty> GreaterThanOrEqualTo<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder, Expression<Func<T, TProperty>> valueToCompare)
where TProperty : IComparable<TProperty>, IComparable
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Linq.Expressions.Expression<System.Func<<T>,<TProperty>>>
| valueToCompare | The value being compared
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
GreaterThanOrEqualTo<T, TProperty>(IRuleBuilder<T, TProperty>, Expression<Func<T, Nullable<TProperty>>>)
Defines a 'greater than' validator on the current rule builder using a lambda expression. The validation will succeed if the property value is greater than or equal the specified value. The validation will fail if the property value is less than the specified value.
View Source
public static IRuleBuilderOptions<T, TProperty> GreaterThanOrEqualTo<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder, Expression<Func<T, TProperty?>> valueToCompare)
where TProperty : struct, IComparable<TProperty>, IComparable
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Linq.Expressions.Expression<System.Func<<T>,System.Nullable<<TProperty>>>>
| valueToCompare | The value being compared
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
GreaterThanOrEqualTo<T, TProperty>(IRuleBuilder<T, Nullable<TProperty>>, Expression<Func<T, Nullable<TProperty>>>)
Defines a 'greater than or equal to' validator on the current rule builder using a lambda expression. The validation will succeed if the property value is greater than or equal the specified value. The validation will fail if the property value is less than the specified value.
View Source
public static IRuleBuilderOptions<T, TProperty?> GreaterThanOrEqualTo<T, TProperty>(this IRuleBuilder<T, TProperty?> ruleBuilder, Expression<Func<T, TProperty?>> valueToCompare)
where TProperty : struct, IComparable<TProperty>, IComparable
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,System.Nullable<<TProperty>>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,System.Nullable<<TProperty>>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Linq.Expressions.Expression<System.Func<<T>,System.Nullable<<TProperty>>>>
| valueToCompare | The value being compared
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
GreaterThanOrEqualTo<T, TProperty>(IRuleBuilder<T, Nullable<TProperty>>, Expression<Func<T, TProperty>>)
Defines a 'greater than or equal to' validator on the current rule builder using a lambda expression. The validation will succeed if the property value is greater than or equal the specified value. The validation will fail if the property value is less than the specified value.
View Source
public static IRuleBuilderOptions<T, TProperty?> GreaterThanOrEqualTo<T, TProperty>(this IRuleBuilder<T, TProperty?> ruleBuilder, Expression<Func<T, TProperty>> valueToCompare)
where TProperty : struct, IComparable<TProperty>, IComparable
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,System.Nullable<<TProperty>>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,System.Nullable<<TProperty>>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Linq.Expressions.Expression<System.Func<<T>,<TProperty>>>
| valueToCompare | The value being compared
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
InclusiveBetween<T, TProperty>(IRuleBuilder<T, TProperty>, TProperty, TProperty)
Defines an 'inclusive between' validator on the current rule builder, but only for properties of types that implement IComparable. Validation will fail if the value of the property is outside of the specified range. The range is inclusive.
View Source
public static IRuleBuilderOptions<T, TProperty> InclusiveBetween<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder, TProperty from, TProperty to)
where TProperty : IComparable<TProperty>, IComparable
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| <TProperty>
| from | The lowest allowed value
|
| <TProperty>
| to | The highest allowed value
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
InclusiveBetween<T, TProperty>(IRuleBuilder<T, Nullable<TProperty>>, TProperty, TProperty)
Defines an 'inclusive between' validator on the current rule builder, but only for properties of types that implement IComparable. Validation will fail if the value of the property is outside of the specified range. The range is inclusive.
View Source
public static IRuleBuilderOptions<T, TProperty?> InclusiveBetween<T, TProperty>(this IRuleBuilder<T, TProperty?> ruleBuilder, TProperty from, TProperty to)
where TProperty : struct, IComparable<TProperty>, IComparable
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,System.Nullable<<TProperty>>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,System.Nullable<<TProperty>>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| <TProperty>
| from | The lowest allowed value
|
| <TProperty>
| to | The highest allowed value
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
ExclusiveBetween<T, TProperty>(IRuleBuilder<T, TProperty>, TProperty, TProperty)
Defines an 'exclusive between' validator on the current rule builder, but only for properties of types that implement IComparable. Validation will fail if the value of the property is outside of the specified range. The range is exclusive.
View Source
public static IRuleBuilderOptions<T, TProperty> ExclusiveBetween<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder, TProperty from, TProperty to)
where TProperty : IComparable<TProperty>, IComparable
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| <TProperty>
| from | The lowest allowed value
|
| <TProperty>
| to | The highest allowed value
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
ExclusiveBetween<T, TProperty>(IRuleBuilder<T, Nullable<TProperty>>, TProperty, TProperty)
Defines an 'exclusive between' validator on the current rule builder, but only for properties of types that implement IComparable. Validation will fail if the value of the property is outside of the specified range. The range is exclusive.
View Source
public static IRuleBuilderOptions<T, TProperty?> ExclusiveBetween<T, TProperty>(this IRuleBuilder<T, TProperty?> ruleBuilder, TProperty from, TProperty to)
where TProperty : struct, IComparable<TProperty>, IComparable
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,System.Nullable<<TProperty>>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,System.Nullable<<TProperty>>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| <TProperty>
| from | The lowest allowed value
|
| <TProperty>
| to | The highest allowed value
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
TProperty | Type of property being validated |
CreditCard<T>(IRuleBuilder<T, String>)
Defines a credit card validator for the current rule builder that ensures that the specified string is a valid credit card number.
View Source
public static IRuleBuilderOptions<T, string> CreditCard<T>(this IRuleBuilder<T, string> ruleBuilder)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,System.String>
Parameters
Type | Name |
---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,System.String> | ruleBuilder |
Type Parameters
T
IsInEnum<T, TProperty>(IRuleBuilder<T, TProperty>)
Defines a enum value validator on the current rule builder that ensures that the specific value is a valid enum value.
View Source
public static IRuleBuilderOptions<T, TProperty> IsInEnum<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder | The rule builder on which the validator should be defined |
|
Type Parameters
Name | Description |
---|---|
T | Type of Enum being validated |
TProperty | Type of property being validated |
ScalePrecision<T>(IRuleBuilder<T, Decimal>, Int32, Int32, Boolean)
Defines a scale precision validator on the current rule builder that ensures that the specific value has a certain scale and precision
View Source
public static IRuleBuilderOptions<T, decimal> ScalePrecision<T>(this IRuleBuilder<T, decimal> ruleBuilder, int scale, int precision, bool ignoreTrailingZeros = false)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,System.Decimal>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,System.Decimal> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Int32
| scale | Allowed scale of the value
|
| System.Int32
| precision | Allowed precision of the value
|
| System.Boolean
| ignoreTrailingZeros | Whether the validator will ignore trailing zeros.
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
ScalePrecision<T>(IRuleBuilder<T, Nullable<Decimal>>, Int32, Int32, Boolean)
Defines a scale precision validator on the current rule builder that ensures that the specific value has a certain scale and precision
View Source
public static IRuleBuilderOptions<T, decimal?> ScalePrecision<T>(this IRuleBuilder<T, decimal?> ruleBuilder, int scale, int precision, bool ignoreTrailingZeros = false)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,System.Nullable<System.Decimal>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,System.Nullable<System.Decimal>> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Int32
| scale | Allowed scale of the value
|
| System.Int32
| precision | Allowed precision of the value
|
| System.Boolean
| ignoreTrailingZeros | Whether the validator will ignore trailing zeros.
|
Type Parameters
Name | Description |
---|---|
T | Type of object being validated |
Custom<T, TProperty>(IRuleBuilder<T, TProperty>, Action<TProperty, CustomContext>)
Defines a custom validation rule
View Source
public static IRuleBuilderInitial<T, TProperty> Custom<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder, Action<TProperty, CustomContext> action)
Returns
ServiceStack.FluentValidation.IRuleBuilderInitial<<T>,<TProperty>>
Parameters
Type | Name |
---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder |
System.Action<<TProperty>,ServiceStack.FluentValidation.Validators.CustomContext> | action |
Type Parameters
T
TProperty
CustomAsync<T, TProperty>(IRuleBuilder<T, TProperty>, Func<TProperty, CustomContext, CancellationToken, Task>)
Defines a custom validation rule
View Source
public static IRuleBuilderInitial<T, TProperty> CustomAsync<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder, Func<TProperty, CustomContext, CancellationToken, Task> action)
Returns
ServiceStack.FluentValidation.IRuleBuilderInitial<<T>,<TProperty>>
Parameters
Type | Name |
---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder |
System.Func<<TProperty>,ServiceStack.FluentValidation.Validators.CustomContext,System.Threading.CancellationToken,System.Threading.Tasks.Task> | action |
Type Parameters
T
TProperty
ForEach<T, TElement>(IRuleBuilder<T, IEnumerable<TElement>>, Action<IRuleBuilderInitialCollection<IEnumerable<TElement>, TElement>>)
Allows rules to be built against individual elements in the collection.
View Source
public static IRuleBuilderOptions<T, IEnumerable<TElement>> ForEach<T, TElement>(this IRuleBuilder<T, IEnumerable<TElement>> ruleBuilder, Action<IRuleBuilderInitialCollection<IEnumerable<TElement>, TElement>> action)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,System.Collections.Generic.IEnumerable<<TElement>>>
Parameters
Type | Name |
---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,System.Collections.Generic.IEnumerable<<TElement>>> | ruleBuilder |
System.Action<ServiceStack.FluentValidation.IRuleBuilderInitialCollection<System.Collections.Generic.IEnumerable<<TElement>>,<TElement>>> | action |
Type Parameters
T
TElement
IsEnumName<T>(IRuleBuilder<T, String>, Type, Boolean)
Defines a enum value validator on the current rule builder that ensures that the specific value is a valid enum name.
View Source
public static IRuleBuilderOptions<T, string> IsEnumName<T>(this IRuleBuilder<T, string> ruleBuilder, Type enumType, bool caseSensitive = true)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,System.String>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,System.String> | ruleBuilder | The rule builder on which the validator should be defined |
|
| System.Type
| enumType | The enum whose the string should match any name
|
| System.Boolean
| caseSensitive | If the comparison between the string and the enum names should be case sensitive
|
Type Parameters
Name | Description |
---|---|
T | Type of Enum being validated |
ChildRules<T, TProperty>(IRuleBuilder<T, TProperty>, Action<InlineValidator<TProperty>>)
Defines child rules for a nested property.
View Source
public static IRuleBuilderOptions<T, TProperty> ChildRules<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder, Action<InlineValidator<TProperty>> action)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder | The rule builder. |
|
| System.Action<ServiceStack.FluentValidation.InlineValidator<<TProperty>>>
| action | Callback that will be invoked to build the rules.
|
Type Parameters
T
TProperty
SetInheritanceValidator<T, TProperty>(IRuleBuilder<T, TProperty>, Action<PolymorphicValidator<T, TProperty>>)
Defines one or more validators that can be used to validate sub-classes or implementors in an inheritance hierarchy. This is useful when the property being validated is an interface or base-class, but you want to define rules for properties of a specific subclass.
View Source
public static IRuleBuilderOptions<T, TProperty> SetInheritanceValidator<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder, Action<PolymorphicValidator<T, TProperty>> validatorConfiguration)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>> | ruleBuilder |
|
| System.Action<ServiceStack.FluentValidation.Validators.PolymorphicValidator<<T>,<TProperty>>>
| validatorConfiguration | Callback for setting up the inheritance validators.
|
Type Parameters
T
TProperty
Validate<T>(IValidator<T>, T, Action<ValidationStrategy<T>>)
Validates the specified instance using a combination of extra options
View Source
public static ValidationResult Validate<T>(this IValidator<T> validator, T instance, Action<ValidationStrategy<T>> options)
Returns
ServiceStack.FluentValidation.Results.ValidationResult
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IValidator<T> | validator | The validator |
|
| <T>
| instance | The instance to validate
|
| System.Action<ServiceStack.FluentValidation.Internal.ValidationStrategy<<T>>>
| options | Callback to configure additional options
|
Type Parameters
T
ValidateAsync<T>(IValidator<T>, T, Action<ValidationStrategy<T>>, CancellationToken)
Validates the specified instance using a combination of extra options
View Source
public static Task<ValidationResult> ValidateAsync<T>(this IValidator<T> validator, T instance, Action<ValidationStrategy<T>> options, CancellationToken cancellation = default(CancellationToken))
Returns
System.Threading.Tasks.Task<ServiceStack.FluentValidation.Results.ValidationResult>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IValidator<T> | validator | The validator |
|
| <T>
| instance | The instance to validate
|
| System.Action<ServiceStack.FluentValidation.Internal.ValidationStrategy<<T>>>
| options | Callback to configure additional options
|
| System.Threading.CancellationToken
| cancellation | Cancellation token
|
Type Parameters
T
ValidateAndThrow<T>(IValidator<T>, T)
Performs validation and then throws an exception if validation fails. This method is a shortcut for: Validate(instance, options => options.ThrowOnFailures());
View Source
public static void ValidateAndThrow<T>(this IValidator<T> validator, T instance)
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IValidator<T> | validator | The validator this method is extending. |
|
| <T>
| instance | The instance of the type we are validating.
|
Type Parameters
T
ValidateAndThrowAsync<T>(IValidator<T>, T, CancellationToken)
Performs validation asynchronously and then throws an exception if validation fails. This method is a shortcut for: ValidateAsync(instance, options => options.ThrowOnFailures());
View Source
public static async Task ValidateAndThrowAsync<T>(this IValidator<T> validator, T instance, CancellationToken cancellationToken = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IValidator<T> | validator | The validator this method is extending. |
|
| <T>
| instance | The instance of the type we are validating.
|
| System.Threading.CancellationToken
| cancellationToken |
|
Type Parameters
T
Validate<T>(IValidator<T>, T, Expression<Func<T, Object>>[])
Validates certain properties of the specified instance.
View Source
[Obsolete("This method will be removed in FluentValidation 10. Instead use Validate(instance, options => options.IncludeProperties(expressions))")]
public static ValidationResult Validate<T>(this IValidator<T> validator, T instance, params Expression<Func<T, object>>[] propertyExpressions)
Returns
ServiceStack.FluentValidation.Results.ValidationResult: A ValidationResult object containing any validation failures
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IValidator<T> | validator | The current validator |
|
| <T>
| instance | The object to validate
|
| System.Linq.Expressions.Expression<System.Func<<T>,System.Object>>[]
| propertyExpressions | Expressions to specify the properties to validate
|
Type Parameters
T
Validate<T>(IValidator<T>, T, String[])
Validates certain properties of the specified instance.
View Source
[Obsolete("This method will be removed in FluentValidation 10. Instead use Validate(instance, options => options.IncludeProperties(properties))")]
public static ValidationResult Validate<T>(this IValidator<T> validator, T instance, params string[] properties)
Returns
ServiceStack.FluentValidation.Results.ValidationResult: A ValidationResult object containing any validation failures.
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IValidator<T> | validator |
|
| <T>
| instance | The object to validate
|
| System.String[]
| properties | The names of the properties to validate.
|
Type Parameters
T
Validate<T>(IValidator<T>, T, IValidatorSelector, String)
Validates an object using either a custom validator selector or a ruleset.
View Source
[Obsolete("This method will be removed in FluentValidation 10. Instead call Validate(instance, options => options.IncludeRuleSets(\"someRuleSet\",\"anotherRuleSet\")). Be sure to pass in separate strings rather than a comma-separated string.")]
public static ValidationResult Validate<T>(this IValidator<T> validator, T instance, IValidatorSelector selector = null, string ruleSet = null)
Returns
ServiceStack.FluentValidation.Results.ValidationResult
Parameters
Type | Name |
---|---|
ServiceStack.FluentValidation.IValidator<T> | validator |
<T> | instance |
ServiceStack.FluentValidation.Internal.IValidatorSelector | selector |
System.String | ruleSet |
Type Parameters
T
ValidateAsync<T>(IValidator<T>, T, CancellationToken, Expression<Func<T, Object>>[])
Validates certain properties of the specified instance asynchronously.
View Source
[Obsolete("This method will be removed in FluentValidation 10. Instead use ValidateAsync(instance, options => options.IncludeProperties(expressions), cancellationToken)")]
public static Task<ValidationResult> ValidateAsync<T>(this IValidator<T> validator, T instance, CancellationToken cancellationToken = default(CancellationToken), params Expression<Func<T, object>>[] propertyExpressions)
Returns
System.Threading.Tasks.Task<ServiceStack.FluentValidation.Results.ValidationResult>
: A ValidationResult object containing any validation failures
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IValidator<T> | validator | The current validator |
|
| <T>
| instance | The object to validate
|
| System.Threading.CancellationToken
| cancellationToken |
|
| System.Linq.Expressions.Expression<System.Func<<T>,System.Object>>[]
| propertyExpressions | Expressions to specify the properties to validate
|
Type Parameters
T
ValidateAsync<T>(IValidator<T>, T, CancellationToken, String[])
Validates certain properties of the specified instance asynchronously.
View Source
[Obsolete("This method will be removed in FluentValidation 10. Instead use ValidateAsync(instance, options => options.IncludeProperties(properties), cancellationToken)")]
public static Task<ValidationResult> ValidateAsync<T>(this IValidator<T> validator, T instance, CancellationToken cancellationToken = default(CancellationToken), params string[] properties)
Returns
System.Threading.Tasks.Task<ServiceStack.FluentValidation.Results.ValidationResult>
: A ValidationResult object containing any validation failures.
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IValidator<T> | validator |
|
| <T>
| instance | The object to validate
|
| System.Threading.CancellationToken
| cancellationToken |
|
| System.String[]
| properties | The names of the properties to validate.
|
Type Parameters
T
ValidateAsync<T>(IValidator<T>, T, CancellationToken, IValidatorSelector, String)
Validates an object asynchronously using a custom validator selector or a ruleset
View Source
[Obsolete("This method will be removed in FluentValidation 10. Instead call ValidateAsync(instance, options => options.IncludeRuleSets(\"someRuleSet\",\"anotherRuleSet\"), cancellationToken). Be sure to pass in separate strings rather than a comma-separated string.")]
public static Task<ValidationResult> ValidateAsync<T>(this IValidator<T> validator, T instance, CancellationToken cancellationToken = default(CancellationToken), IValidatorSelector selector = null, string ruleSet = null)
Returns
System.Threading.Tasks.Task<ServiceStack.FluentValidation.Results.ValidationResult>
Parameters
Type | Name |
---|---|
ServiceStack.FluentValidation.IValidator<T> | validator |
<T> | instance |
System.Threading.CancellationToken | cancellationToken |
ServiceStack.FluentValidation.Internal.IValidatorSelector | selector |
System.String | ruleSet |
Type Parameters
T
ValidateAndThrow<T>(IValidator<T>, T, String)
Performs validation and then throws an exception if validation fails.
View Source
[Obsolete("This method will be removed in FluentValidation 10. Instead call Validate(instance, options => options.IncludeRuleSets(\"someRuleSet\",\"anotherRuleSet\").ThrowOnFailures()). Be sure to pass in separate strings rather than a comma-separated string for rulesets.")]
public static void ValidateAndThrow<T>(this IValidator<T> validator, T instance, string ruleSet)
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IValidator<T> | validator | The validator this method is extending. |
|
| <T>
| instance | The instance of the type we are validating.
|
| System.String
| ruleSet | Optional: a ruleset when need to validate against.
|
Type Parameters
T
ValidateAndThrowAsync<T>(IValidator<T>, T, String, CancellationToken)
Performs validation asynchronously and then throws an exception if validation fails.
View Source
[Obsolete("This method will be removed in FluentValidation 10. Instead call ValidateAsync(instance, options => options.IncludeRuleSets(\"someRuleSet\",\"anotherRuleSet\").ThrowOnFailures(), cancellationToken). Be sure to pass in separate strings rather than a comma-separated string for rulesets.")]
public static async Task ValidateAndThrowAsync<T>(this IValidator<T> validator, T instance, string ruleSet, CancellationToken cancellationToken = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IValidator<T> | validator | The validator this method is extending. |
|
| <T>
| instance | The instance of the type we are validating.
|
| System.String
| ruleSet | Optional: a ruleset when need to validate against.
|
| System.Threading.CancellationToken
| cancellationToken |
|
Type Parameters
T