FluentValidationModelValidatorProvider
Implementation of ModelValidatorProvider that uses FluentValidation.
Assembly: ServiceStack.Mvc.dll
View Source
Declaration
public class FluentValidationModelValidatorProvider : ModelValidatorProvider
Properties
AddImplicitRequiredValidator
View Source
Declaration
public bool AddImplicitRequiredValidator { get; set; }
ValidatorFactory
View Source
Declaration
public IValidatorFactory ValidatorFactory { get; set; }
Methods
Configure(Action<FluentValidationModelValidatorProvider>)
Initializes the FluentValidationModelValidatorProvider using the default options and adds it in to the ModelValidatorProviders collection.
View Source
Declaration
public static void Configure(Action<FluentValidationModelValidatorProvider> configurationExpression = null)
Parameters
Type | Name |
---|---|
System.Action<ServiceStack.FluentValidation.Mvc.FluentValidationModelValidatorProvider> | configurationExpression |
Add(Type, FluentValidationModelValidationFactory)
View Source
Declaration
public void Add(Type validatorType, FluentValidationModelValidationFactory factory)
Parameters
Type | Name |
---|---|
System.Type | validatorType |
ServiceStack.FluentValidation.Mvc.FluentValidationModelValidationFactory | factory |
GetValidators(ModelMetadata, ControllerContext)
View Source
Declaration
public override IEnumerable<ModelValidator> GetValidators(ModelMetadata metadata, ControllerContext context)
Returns
System.Collections.Generic.IEnumerable<ModelValidator>
Parameters
Type | Name |
---|---|
ModelMetadata | metadata |
ControllerContext | context |
CreateValidator(ModelMetadata, ControllerContext)
View Source
Declaration
protected virtual IValidator CreateValidator(ModelMetadata metadata, ControllerContext context)
Returns
ServiceStack.FluentValidation.IValidator
Parameters
Type | Name |
---|---|
ModelMetadata | metadata |
ControllerContext | context |
GetValidatorsForProperty(ModelMetadata, ControllerContext, IValidator)
View Source
Declaration
protected IEnumerable<ModelValidator> GetValidatorsForProperty(ModelMetadata metadata, ControllerContext context, IValidator validator)
Returns
System.Collections.Generic.IEnumerable<ModelValidator>
Parameters
Type | Name |
---|---|
ModelMetadata | metadata |
ControllerContext | context |
ServiceStack.FluentValidation.IValidator | validator |
GetModelValidator(ModelMetadata, ControllerContext, PropertyRule, IPropertyValidator)
View Source
Declaration
protected virtual ModelValidator GetModelValidator(ModelMetadata meta, ControllerContext context, PropertyRule rule, IPropertyValidator propertyValidator)
Returns
ModelValidator
Parameters
Type | Name |
---|---|
ModelMetadata | meta |
ControllerContext | context |
ServiceStack.FluentValidation.Internal.PropertyRule | rule |
ServiceStack.FluentValidation.Validators.IPropertyValidator | propertyValidator |
CreateNotNullValidatorForProperty(ModelMetadata, ControllerContext)
View Source
Declaration
protected virtual ModelValidator CreateNotNullValidatorForProperty(ModelMetadata metadata, ControllerContext cc)
Returns
ModelValidator
Parameters
Type | Name |
---|---|
ModelMetadata | metadata |
ControllerContext | cc |
GetValidatorsForModel(ModelMetadata, ControllerContext, IValidator)
View Source
Declaration
protected virtual IEnumerable<ModelValidator> GetValidatorsForModel(ModelMetadata metadata, ControllerContext context, IValidator validator)
Returns
System.Collections.Generic.IEnumerable<ModelValidator>
Parameters
Type | Name |
---|---|
ModelMetadata | metadata |
ControllerContext | context |
ServiceStack.FluentValidation.IValidator | validator |
IsValidatingProperty(ModelMetadata)
View Source
Declaration
protected virtual bool IsValidatingProperty(ModelMetadata metadata)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ModelMetadata | metadata |