Show / Hide Table of Contents

Class ValueContext

A model which provides contextual information about a value which is validated.

Inheritance
System.Object
ValueContext
RuleContext
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: CSF.Validation.Rules
Assembly: CSF.Validation.Abstractions.dll
Syntax
public class ValueContext

Constructors

| Improve this Doc View Source

ValueContext(Object, Object, ManifestItem, Nullable<Int64>)

Initializes a new instance of ValueContext.

Declaration
public ValueContext(object identity, object actualValue, ManifestItem manifestValue, long? collectionItemOrder = null)
Parameters
Type Name Description
System.Object identity

The object identity associated with this ancestor context.

System.Object actualValue

The object being validated in this ancestor context.

ManifestItem manifestValue

The manifest value.

System.Nullable<System.Int64> collectionItemOrder

The collection index by which you would traverse from this ancestor context to its immediate child (where applicable).

Properties

| Improve this Doc View Source

ActualValue

Gets the value which is being validated.

Declaration
public object ActualValue { get; }
Property Value
Type Description
System.Object
Remarks

Developers do not need to use this property to get the primary value under validation when they are using the IRule<TValidated> interface. The first parameter passed to GetResultAsync(TValidated, RuleContext, CancellationToken) is the same as this property, but it is presented in a strongly-typed manner.

Likewise, when developers are using the interface IRule<TValue, TParent>, they do not need to use this property to get the value from the first ancestor context (see AncestorContexts). That parent valus will be presented as the second parameter to GetResultAsync(TValue, TParent, RuleContext, CancellationToken).

This property may be used within rule logic to access more distant ancestors, if they are required.

| Improve this Doc View Source

CollectionItemOrder

Gets a numeric item order, indicating the order in which this value was retrieved from a collection.

Declaration
public long? CollectionItemOrder { get; }
Property Value
Type Description
System.Nullable<System.Int64>
Remarks

This is not neccesarily a collection index, because a collection of values to be validated might only be System.Collections.Generic.IEnumerable<T> and not (for example) System.Collections.Generic.IList<T>. Thus, the order in which values are retrieved might not be meaningful and might not even be stable.

If the current validated value does not represent an item from a collection then this property will contain null.

| Improve this Doc View Source

ObjectIdentity

Gets the identity associated with the current value.

Declaration
public object ObjectIdentity { get; }
Property Value
Type Description
System.Object
Remarks

The object (or value) identity is used to distinguish this value from other objects/values of the same type. This is particularly useful when validating collections of similar objects.

| Improve this Doc View Source

ValueInfo

Gets a ManifestValueInfo with information about the configuration of the current validated value.

Declaration
public ManifestValueInfo ValueInfo { get; }
Property Value
Type Description
ManifestValueInfo
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX