ValidationContext<T>
Validation context
Assembly: ServiceStack.dll
View Source
public class ValidationContext<T> : IValidationContext, ICommonContext
Properties
InstanceToValidate
The object to validate
View Source
public T InstanceToValidate { get; }
RootContextData
Additional data associated with the validation request.
View Source
public IDictionary<string, object> RootContextData { get; }
PropertyChain
Property chain
View Source
public PropertyChain PropertyChain { get; }
ICommonContext.InstanceToValidate
Object being validated
View Source
object ICommonContext.InstanceToValidate { get; }
Selector
Selector
View Source
public IValidatorSelector Selector { get; }
IsChildContext
Whether this is a child context
View Source
public virtual bool IsChildContext { get; }
IsChildCollectionContext
Whether this is a child collection context.
View Source
public virtual bool IsChildCollectionContext { get; }
ICommonContext.PropertyValue
View Source
object ICommonContext.PropertyValue { get; }
ICommonContext.ParentContext
View Source
ICommonContext ICommonContext.ParentContext { get; }
ThrowOnFailures
Whether the root validator should throw an exception when validation fails. Defaults to false.
View Source
public bool ThrowOnFailures { get; }
Request
View Source
public IRequest Request { get; set; }
Methods
CreateWithOptions(T, Action<ValidationStrategy<T>>)
Creates a new validation context using the specified options.
View Source
public static ValidationContext<T> CreateWithOptions(T instanceToValidate, Action<ValidationStrategy<T>> options)
Returns
ServiceStack.FluentValidation.ValidationContext<T>
Parameters
Type | Name | Description |
---|---|---|
<T> | instanceToValidate | The instance to validate |
|
| System.Action<ServiceStack.FluentValidation.Internal.ValidationStrategy<<T>>>
| options | Callback that allows extra options to be configured.
|
GetFromNonGenericContext(IValidationContext)
Gets or creates generic validation context from non-generic validation context.
View Source
public static ValidationContext<T> GetFromNonGenericContext(IValidationContext context)
Returns
ServiceStack.FluentValidation.ValidationContext<T>
Parameters
Type | Name |
---|---|
ServiceStack.FluentValidation.IValidationContext | context |
CloneForChildValidator<TChild>(TChild, Boolean, IValidatorSelector)
Creates a new validation context for use with a child validator
View Source
public ValidationContext<TChild> CloneForChildValidator<TChild>(TChild instanceToValidate, bool preserveParentContext = false, IValidatorSelector selector = null)
Returns
ServiceStack.FluentValidation.ValidationContext<T>
Parameters
Type | Name |
---|---|
<TChild> | instanceToValidate |
System.Boolean | preserveParentContext |
ServiceStack.FluentValidation.Internal.IValidatorSelector | selector |
Type Parameters
TChild
CloneForChildCollectionValidator<TNew>(TNew, Boolean)
Creates a new validation context for use with a child collection validator
View Source
public ValidationContext<TNew> CloneForChildCollectionValidator<TNew>(TNew instanceToValidate, bool preserveParentContext = false)
Returns
ServiceStack.FluentValidation.ValidationContext<T>
Parameters
Type | Name |
---|---|
<TNew> | instanceToValidate |
System.Boolean | preserveParentContext |
Type Parameters
TNew