RuleBuilder<T, TProperty>
Builds a validation rule and constructs a validator.
Assembly: ServiceStack.dll
View Source
public class RuleBuilder<T, TProperty> : IRuleBuilderOptions<T, TProperty>, IConfigurable<PropertyRule, IRuleBuilderOptions<T, TProperty>>, IRuleBuilderInitial<T, TProperty>, IConfigurable<PropertyRule, IRuleBuilderInitial<T, TProperty>>, IRuleBuilderInitialCollection<T, TProperty>, IRuleBuilder<T, TProperty>, IConfigurable<CollectionPropertyRule<T, TProperty>, IRuleBuilderInitialCollection<T, TProperty>>
Properties
Rule
The rule being created by this RuleBuilder.
View Source
public PropertyRule Rule { get; }
ParentValidator
Parent validator
View Source
public IValidator<T> ParentValidator { get; }
Methods
SetValidator(IPropertyValidator)
Sets the validator associated with the rule.
View Source
public IRuleBuilderOptions<T, TProperty> SetValidator(IPropertyValidator validator)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.Validators.IPropertyValidator | validator | The validator to set |
|
SetValidator(IValidator<TProperty>, String[])
Sets the validator associated with the rule. Use with complex properties where an IValidator instance is already declared for the property type.
View Source
public IRuleBuilderOptions<T, TProperty> SetValidator(IValidator<TProperty> validator, params string[] ruleSets)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IValidator<T> | validator | The validator to set |
|
| System.String[]
| ruleSets |
|
SetValidator<TValidator>(Func<T, TValidator>, String[])
Sets the validator associated with the rule. Use with complex properties where an IValidator instance is already declared for the property type.
View Source
public IRuleBuilderOptions<T, TProperty> SetValidator<TValidator>(Func<T, TValidator> validatorProvider, params string[] ruleSets)
where TValidator : IValidator<TProperty>
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
System.Func<<T>,<TValidator>> | validatorProvider | The validator provider to set |
|
| System.String[]
| ruleSets |
|
Type Parameters
TValidator
SetValidator<TValidator>(Func<T, TProperty, TValidator>, String[])
Associates a validator provider with the current property rule.
View Source
public IRuleBuilderOptions<T, TProperty> SetValidator<TValidator>(Func<T, TProperty, TValidator> validatorProvider, params string[] ruleSets)
where TValidator : IValidator<TProperty>
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
System.Func<<T>,<TProperty>,<TValidator>> | validatorProvider | The validator provider to use |
|
| System.String[]
| ruleSets |
|
Type Parameters
TValidator
SetValidator<TValidator>(Func<ICommonContext, TValidator>)
Sets the validator associated with the rule. Use with complex properties where an IValidator instance is already declared for the property type.
View Source
public IRuleBuilderOptions<T, TProperty> SetValidator<TValidator>(Func<ICommonContext, TValidator> validatorProvider)
where TValidator : IValidator<TProperty>
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name | Description |
---|---|---|
System.Func<ServiceStack.FluentValidation.ICommonContext,<TValidator>> | validatorProvider | The validator provider to set |
|
Type Parameters
TValidator
IConfigurable<PropertyRule, IRuleBuilderOptions<T, TProperty>>.Configure(Action<PropertyRule>)
View Source
IRuleBuilderOptions<T, TProperty> IConfigurable<PropertyRule, IRuleBuilderOptions<T, TProperty>>.Configure(Action<PropertyRule> configurator)
Returns
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
Parameters
Type | Name |
---|---|
System.Action<ServiceStack.FluentValidation.Internal.PropertyRule> | configurator |
IConfigurable<PropertyRule, IRuleBuilderInitial<T, TProperty>>.Configure(Action<PropertyRule>)
View Source
IRuleBuilderInitial<T, TProperty> IConfigurable<PropertyRule, IRuleBuilderInitial<T, TProperty>>.Configure(Action<PropertyRule> configurator)
Returns
ServiceStack.FluentValidation.IRuleBuilderInitial<<T>,<TProperty>>
Parameters
Type | Name |
---|---|
System.Action<ServiceStack.FluentValidation.Internal.PropertyRule> | configurator |
IConfigurable<CollectionPropertyRule<T, TProperty>, IRuleBuilderInitialCollection<T, TProperty>>.Configure(Action<CollectionPropertyRule<T, TProperty>>)
View Source
IRuleBuilderInitialCollection<T, TProperty> IConfigurable<CollectionPropertyRule<T, TProperty>, IRuleBuilderInitialCollection<T, TProperty>>.Configure(Action<CollectionPropertyRule<T, TProperty>> configurator)
Returns
ServiceStack.FluentValidation.IRuleBuilderInitialCollection<<T>,<TProperty>>
Parameters
Type | Name |
---|---|
System.Action<ServiceStack.FluentValidation.Internal.CollectionPropertyRule<<T>,<TProperty>>> | configurator |
Transform<TNew>(Func<TProperty, TNew>)
View Source
[Obsolete("Use RuleFor(x => x.Property, transformer) instead. This method will be removed in FluentValidation 10.")]
public IRuleBuilderInitial<T, TNew> Transform<TNew>(Func<TProperty, TNew> transformationFunc)
Returns
ServiceStack.FluentValidation.IRuleBuilderInitial<<T>,<TNew>>
Parameters
Type | Name |
---|---|
System.Func<<TProperty>,<TNew>> | transformationFunc |
Type Parameters
TNew
Implements
ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>
ServiceStack.FluentValidation.Internal.IConfigurable<ServiceStack.FluentValidation.Internal.PropertyRule,ServiceStack.FluentValidation.IRuleBuilderOptions<<T>,<TProperty>>>
ServiceStack.FluentValidation.IRuleBuilderInitial<<T>,<TProperty>>
ServiceStack.FluentValidation.Internal.IConfigurable<ServiceStack.FluentValidation.Internal.PropertyRule,ServiceStack.FluentValidation.IRuleBuilderInitial<<T>,<TProperty>>>
ServiceStack.FluentValidation.IRuleBuilderInitialCollection<<T>,<TProperty>>
ServiceStack.FluentValidation.IRuleBuilder<<T>,<TProperty>>
ServiceStack.FluentValidation.Internal.IConfigurable<ServiceStack.FluentValidation.Internal.CollectionPropertyRule<<T>,<TProperty>>,ServiceStack.FluentValidation.IRuleBuilderInitialCollection<<T>,<TProperty>>>