Show / Hide Table of Contents

Class ValidationResult

A model for the results of a validation process.

Inheritance
System.Object
ValidationResult
ValidationResult<TValidated>
Implements
IQueryableValidationResult
System.Collections.Generic.IEnumerable<ValidationRuleResult>
System.Collections.IEnumerable
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)
Namespace: CSF.Validation
Assembly: CSF.Validation.Abstractions.dll
Syntax
public abstract class ValidationResult : IQueryableValidationResult, IEnumerable<ValidationRuleResult>, IEnumerable

Constructors

| Improve this Doc View Source

ValidationResult(IEnumerable<ValidationRuleResult>, ValidationManifest, Nullable<TimeSpan>)

Initialises a new instance of ValidationResult.

Declaration
protected ValidationResult(IEnumerable<ValidationRuleResult> ruleResults, ValidationManifest manifest, TimeSpan? validationTime = null)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<ValidationRuleResult> ruleResults

The rule results.

ValidationManifest manifest

The validation manifest

System.Nullable<System.TimeSpan> validationTime

The time it has taken to perform validation.

Exceptions
Type Condition
System.ArgumentNullException

If either of the first two parameters is null.

Properties

| Improve this Doc View Source

Manifest

Declaration
public ValidationManifest Manifest { get; }
Property Value
Type Description
ValidationManifest
| Improve this Doc View Source

Passed

Gets a value that indicates whether or not the current instance represents passing validation.

Declaration
public bool Passed { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

RuleResults

Gets a collection of the results of individual validation rules, making up the current validation result.

Declaration
public IReadOnlyCollection<ValidationRuleResult> RuleResults { get; }
Property Value
Type Description
System.Collections.Generic.IReadOnlyCollection<ValidationRuleResult>
| Improve this Doc View Source

ValidationTime

Gets a value indicating how long the validation process took.

Declaration
public TimeSpan? ValidationTime { get; }
Property Value
Type Description
System.Nullable<System.TimeSpan>
Remarks

This value will only be populated if InstrumentRuleExecution is set to true. Otherwise it will be null.

When EnableRuleParallelization is true the sum of the times reported within each InstrumentationData will likely not total the amount reported by this property. That is because many of the reported times for each of the rules will have run concurrently with other rules. On the other hand, this time does correspond to real "wall clock" time to perform validation.

Methods

| Improve this Doc View Source

AsResultFor<T>()

Gets a representation of the current queryable result as a strongly-typed queryable result.

Declaration
public IQueryableValidationResult<T> AsResultFor<T>()
Returns
Type Description
IQueryableValidationResult<T>

The same conceptual queryable result, cast to a specified type.

Type Parameters
Name Description
T

The validated-type for the queryable result.

Exceptions
Type Condition
System.InvalidCastException

If the T is incompatible with the validated type for the current results.

| Improve this Doc View Source

ToSerializableResult()

Gets a representation of the current result as a serializable validation result.

Declaration
public abstract SerializableValidationResult ToSerializableResult()
Returns
Type Description
SerializableValidationResult

A copy of the current validation result, in an easily-serializable format.

Remarks

Whilst the validation result types represented by IQueryableValidationResult & IQueryableValidationResult<TValidated> are powerful and include querying/matching functionality, they are cumbersome to serialize and/or transmit via network APIs such as JSON or XML. The SerializableValidationResult trades the powerful functionality for a simplified, flattened object model which is easy to serialize, and convert to other formats such as JSON, XML or data to be persisted in a relational database.

| Improve this Doc View Source

ToString()

Gets a string representation of the current instance.

Declaration
public override string ToString()
Returns
Type Description
System.String

A string representation.

Overrides
System.Object.ToString()
| Improve this Doc View Source

ToString(IEnumerable<RuleOutcome>)

Gets a string representation of the current instance, possibly skipping some rule results with irrelevant outcomes.

Declaration
public string ToString(IEnumerable<RuleOutcome> omittedOutcomes)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<RuleOutcome> omittedOutcomes

An optional collection of rule outcomes to omit when displaying rule results.

Returns
Type Description
System.String

A string representation.

Explicit Interface Implementations

| Improve this Doc View Source

IQueryableValidationResult.ManifestValue

Declaration
ManifestItem IQueryableValidationResult.ManifestValue { get; }
Returns
Type Description
ManifestItem
| Improve this Doc View Source

IEnumerable<ValidationRuleResult>.GetEnumerator()

Declaration
IEnumerator<ValidationRuleResult> IEnumerable<ValidationRuleResult>.GetEnumerator()
Returns
Type Description
System.Collections.Generic.IEnumerator<ValidationRuleResult>
| Improve this Doc View Source

IEnumerable.GetEnumerator()

Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type Description
System.Collections.IEnumerator

Implements

IQueryableValidationResult
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX