Class ValidatorBuilderContext
A model for contextual information about a validator-builder.
Inheritance
Inherited Members
Namespace: CSF.Validation.ValidatorBuilding
Assembly: CSF.Validation.dll
Syntax
public sealed class ValidatorBuilderContext : IGetsValidationManifest, IEquatable<ValidatorBuilderContext>
Constructors
| Improve this Doc View SourceValidatorBuilderContext(ManifestItem)
Initialises a new instance of ValidatorBuilderContext.
Declaration
public ValidatorBuilderContext(ManifestItem manifestValue)
Parameters
Type | Name | Description |
---|---|---|
ManifestItem | manifestValue | The manifest value associated with the current context. |
Properties
| Improve this Doc View SourceConfigurationCallbacks
Gets a collection of rule-configuration callbacks for the current instance.
Declaration
public ICollection<IConfiguresContext> ConfigurationCallbacks { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.ICollection<IConfiguresContext> |
Contexts
Gets a collection of contexts contained within the current instance.
Declaration
public ICollection<ValidatorBuilderContext> Contexts { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.ICollection<ValidatorBuilderContext> |
Remarks
It would be wrong to call these "child" contexts, because they might relate to true children (in the nomenclature of Children) but they could also relate to polymorphic types or collection item values. It is better to just think of these as contexts that are to be a part of the ManifestValue in some manner.
IsEligibleToBeRecursive
Gets a value indicating whether or no the current context is eligible to be recursive.
Declaration
public bool IsEligibleToBeRecursive { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
ManifestValue
Gets the ManifestItem instance associated with the current context.
Declaration
public ManifestItem ManifestValue { get; }
Property Value
Type | Description |
---|---|
ManifestItem |
Methods
| Improve this Doc View SourceAssertNotRecursive()
Asserts that the current context is not already recursive. Also marks it ineligible to become recursive.
Declaration
public void AssertNotRecursive()
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | If the current context is already recursive. |
Equals(ValidatorBuilderContext)
Determines whether or not the current instance is equal to the specified other
or not.
Declaration
public bool Equals(ValidatorBuilderContext other)
Parameters
Type | Name | Description |
---|---|---|
ValidatorBuilderContext | other | An object to compare with the current instance. |
Returns
Type | Description |
---|---|
System.Boolean | true if the current instance is equal to the specified object; false otherwise. |
Equals(Object)
Determines whether or not the current instance is equal to the specified obj
or not.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | An object to compare with the current instance. |
Returns
Type | Description |
---|---|
System.Boolean | true if the current instance is equal to the specified object; false otherwise. |
Overrides
GetContextProvider(Object)
Gets a context provider from the specified object.
Declaration
public static IHasValidationBuilderContext GetContextProvider(object provider)
Parameters
Type | Name | Description |
---|---|---|
System.Object | provider | An object which must implement IHasValidationBuilderContext. |
Returns
Type | Description |
---|---|
IHasValidationBuilderContext |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | If the |
System.ArgumentException | If the |
GetHashCode()
Gets a hash code for the current instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | A hash code |
Overrides
GetManifest()
Gets a manifest from the current instance.
Declaration
public ValidationManifest GetManifest()
Returns
Type | Description |
---|---|
ValidationManifest | A validation manifest. |
GetManifestValue()
Gets a manifest value from the current instance.
Declaration
public ManifestItem GetManifestValue()
Returns
Type | Description |
---|---|
ManifestItem | A manifest value. |
MakeRecursive(ManifestItem)
Converts the current context into a recursive one.
Declaration
public void MakeRecursive(ManifestItem ancestor)
Parameters
Type | Name | Description |
---|---|---|
ManifestItem | ancestor | The ancestor manifest item into which validation should recurse. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | If IsEligibleToBeRecursive is false. |
RecursivelyConfigure()
Recursively calls all of the ConfigurationCallbacks upon the current context and all of its descendents: Contexts.
Declaration
public void RecursivelyConfigure()
ToString()
Gets a string representation of the current instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A string representation. |