Namespace CSF.Validation.Rules
Classes
AllChildrenMustBeValues
A rule that asserts all members of the Children collection have the value type Value.
AllPolymorphicTypesMustBeMarkedAsSo
A rule that asserts all members of the PolymorphicTypes collection have the value type PolymorphicType.
CollectionItemValueMustBeCollectionItem
A rule which asserts that the CollectionItemValue property is either null or contains a manifest item with the type CollectionItem.
CollectionItemValueMustBeNullIfValidatedTypeIsNotEnumerable
A rule which asserts that - if the ValidatedType of a ManifestItem is not a type that derives from System.Collections.Generic.IEnumerable<T> then the CollectionItemValue of that manifest item must be null.
CollectionItemValueMustValidateCompatibleTypeForValidatedType
A rule which asserts that - where the OwnCollectionItemValue is not null, it is configured to validate a type (via its own ValidatedType property) that is compatible with the generic type for which the current ValidatedType implements System.Collections.Generic.IEnumerable<T>.
CommonResults
Helper class to create instances of RuleResult instances from commonly-used scenarios.
ContainsNoNullItems
A rule which asserts that a collection contains no items that are null.
ContainsNoNullItems<T>
A rule which asserts that a collection or a queryable value contains no items that are null.
CountInRange<T>
A rule that passes if a validated collection or queryable is either null or has a count of items between inclusive minimum/maximums, configured in this rule.
DateTimeInRange
A validation rule which passes if the validated System.DateTime or System.Nullable<T> DateTime is within an inclusive Start & End range.
DecimalInRange
A validation rule which passes if the validated System.Decimal or System.Nullable<T> decimal is within an inclusive Min & Max range.
DerivesFrom
A rule that passes if the validated value is null or if it derives from a specified type, and fails if it does not.
DerivesFrom<T>
A rule that passes if the validated value is null or if it derives from a specified type, and fails if it does not.
DoesNotDeriveFrom
A rule that passes if the validated value is null or if it does not derive from a specified type, and fails if it does.
DoesNotDeriveFrom<T>
A rule that passes if the validated value is null or if it does not derive from a specified type, and fails if it does.
Empty
A validation rule which passes if the value being validated is either null or is a collection or a string that has no items/is empty.
Empty<T>
A validation rule which passes if the value being validated is either null or is a collection that has no items.
ExceptionHandlingRuleLogicDecorator
A decorator class for the IValidationLogic interface which catches unhandled exceptions raised by the wrapped rule logic and instead returns a RuleResult with Errored.
FloatInRange
A validation rule which passes if the validated floating-point number or System.Nullable<T> floating-point number is within an inclusive Min & Max range. This rule works with all of the CLR-standard floating-point number types.
IntegerInRange
A validation rule which passes if the validated integer or System.Nullable<T> integer is within an inclusive Min & Max range. This rule works with all of the CLR-standard integer types.
LengthInRange
A rule that passes if a validated array, collection or string is either null or has a length/count of items between inclusive minimum/maximums, configured in this rule.
ManifestRuleInfo
An immutable model which provides information about the configuration of a validation rule.
ManifestValueInfo
An immutable model which provides information about the configuration of a value to be validated.
MatchesRegex
A rule which passes if the validated string is either null or is a match for the specified regular expression.
MayNotHaveOwnItemsIfRecursive
A validation rule which asserts that - if the manifest item type is recursive - then the parent manifest item may not have any of its "own" collection item, children, polymorphic types or rules.
MemberMustExist
A rule which asserts that the value indicates a member which exists upon the ValidatedType of the ManifestItem.
MustBeDefinedEnumConstant
A validation rule which asserts that the validated value (which may be nullable) is a defined member of the specified enumerated type.
MustBeDefinedEnumConstant<T>
A validation rule which asserts that the validated value (which may be nullable) is a defined member of the specified enumerated type.
NotEmpty
A validation rule which passes if the value being validated is either null or is a collection or a string that has at least one item/is not empty.
NotEmpty<T>
A validation rule which passes if the value being validated is either null or is a collection that has at least one item.
NotNull
A validation rule which passes if the value being validated is not null and fails if it is.
NotNullIfRecursive
A rule which asserts that a value is not null if the parent ManifestItem is a recursive one.
NotNullIfTheParentIsNotAManifest
A rule which asserts that a value is not null if the Parent is not an instance of ValidationManifest.
NotNullOrEmpty
A validation rule which passes if the object being validated is both not null and not an empty collection. The rule fails if it is either.
NotNullOrEmpty<T>
A validation rule which passes if the object being validated is both not null and not an empty collection. The rule fails if it is either.
Null
A validation rule which passes if the value being validated is null and fails if it is not.
NullIfNotRecursive
A rule which asserts that a value is null if the parent ManifestItem is not a recursive one.
NullIfTheParentIsAManifest
A rule which asserts that a value is null if the Parent is an instance of ValidationManifest.
ParallelizableAttribute
Attribute used to mark rule classes which may be executed in parallel with other rules.
PolymorphicTypeMustDeriveFromParentValidatedType
Validation rule which asserts that for any manifest item which IsPolymorphicType, the ValidatedType of the polymorphic type
RootManifestValueMustHaveParentThatIsValidationManifest
A validation rule which asserts that the Parent is an instance of ValidationManifest.
RootValueMustBeForSameTypeAsManifest
A rule which ensures that the ValidatedType of the ManifestItem which has been used as the RootValue is for the same (or a less-derived) type as the ValidatedType of that manifest.
RootValueMustNotBeNull
A rule which ensures that the RootValue is not null.
RootValueOfManifestMustBeASimpleValue
A rule which verifies that the root manifest item within a validation manifest has an item type equal to Value.
RuleAdapter<TValidated>
An adapter class for instances of IRule<TValidated>, which allows their logic to be executed as if they were instances of the non-generic IValidationLogic interface.
RuleContext
A read-only model for contextual information related to the execution of a validation rule.
RuleContextFactory
A factory service that creates instances of RuleContext from executable rules.
RuleIdentifier
A model for information which uniquely identifies a validation rule within the validation process.
RuleIdentifierBase
Base model for rule identifiers.
RuleMustImplementCompatibleValidationLogic
A rule which asserts that the rule's concrete logic type, RuleType, implements an interface which is compatible with the corresponding manifest item's ValidatedType.
RuleResult
A model for information about the result of running a single validation rule.
RuleWithParentValueAdapter<TValue, TValidated>
An adapter class for instances of IRule<TValue, TParent>, which allows their logic to be executed as if they were instances of the non-generic IValidationLogic interface.
ValidationLogicFactory
A factory service which creates instances of IValidationLogic from ManifestRule definitions.
ValueContext
A model which provides contextual information about a value which is validated.
Interfaces
IGetsRuleContext
An objet that gets a rule context for an executable rule.
IGetsValidationLogic
An object which can get an instance of IValidationLogic for a specified ManifestRule.
IHasRuleTimeout
An object (intended to be a validation rule) which can provide a timeout value, which will terminate the rule early (with an Errored outcome) if the timeout expires before the rule completes execution.
IResolvesRule
An object which can get/resolve instances of validation rule types based upon their concrete System.Type.
IRule<TValidated>
A service for a validation rule which validates an instance of a specified object type.
IRule<TValue, TParent>
A service for a validation rule which validates a value of a specified type and also makes use of a contextual 'parent' value, typically the object from which the first value was retrieved.
IRuleWithMessage<TValidated>
An object which contains both validation rule logic and also can provide a human-readable failure message.
IRuleWithMessage<TValidated, TParent>
An object which contains both validation rule logic and also can provide a human-readable failure message.
IValidationLogic
A generalised/non-generic interface for executing validation logic and getting the results. It is not expected that developers would want to implement this interface for their own rules.
Enums
RuleOutcome
Enumerates the possible outcomes from an attempt to run a single validation rule.