.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET Core 3.0+

RuleSet Members

Specifies a set of Validation Rules that can be checked on an object.

Constructors

Name Description
RuleSet() Initializes a new instance of the RuleSet class.
RuleSet(RuleSet) Initializes a new instance of the RuleSet class with the same rules and rule sources as its parameter.
RuleSet(IEnumerable<IRule>, IEnumerable<IRuleSource>) Initializes a new instance of the RuleSet class.

Fields

Name
NonEmptyValueTypes static

Properties

Name Description
EnableDelayedRuleRegistration Specifies whether all new rules are collected before the RuleSet.GetRules method returns them.
IgnoreWarningAndInformationRules Specifies whether or not the ValidationOutcome.Warning and ValidationOutcome.Information rule validation result types are ignored (see IRuleBaseProperties.ResultType).
NeedToValidateAggregatedRulesInNestedObjectSpace static Specifies whether or not the RuleSet.NeedToValidateRule method will return true when a rule with an assigned IRuleSupportsCollectionAggregatesProperties.TargetCollectionAggregate property and an object from nested Object Space are passed.
RegisteredRules Specifies a list of rules registered in the RuleSet.
RegisteredSources Specifies a list of rule sources registered in the current RuleSet.

Methods

Name Description
Clear() Clears the RuleSet.RegisteredRules and RuleSet.RegisteredSources of the RuleSet.
Equals(Object) Determines whether the specified object is equal to the current object. Inherited from Object.
Equals(Object, Object) static Determines whether the specified object instances are considered equal. Inherited from Object.
FindRule(String) Returns a rule by its ID.
GetEnumerator() Returns an enumerator that iterates through a collection of rules.
GetHashCode() Serves as the default hash function. Inherited from Object.
GetRules() Returns a list of all rules registered in the RuleSet.
GetRules(IEnumerable<Type>) Returns a list of rules that belongs to the current RuleSet.
GetRules(IEnumerable) Returns a list of all rules that belong to the objects listed in a parameter.
GetRules(Object) Returns a list of all rules that belong to the object specified in a parameter.
GetRules(Object, ContextIdentifiers) Returns a list of all rules for the given object and validation contexts.
GetRules(Type, ContextIdentifiers) Returns a list of rules for the given type and validation contexts.
GetType() Gets the Type of the current instance. Inherited from Object.
IsEmptyValue(Object, String, Object) static Determines whether or not the validation rule's target property value is considered empty.
IsEmptyValueType(Type) static
MemberwiseClone() protected Creates a shallow copy of the current Object. Inherited from Object.
NeedToValidateRule(IObjectSpace, IRule, Object, String, out String) static Checks if the rule is marked to be validated.
NeedToValidateRule(IObjectSpace, IRule, Object, out String) static Checks if the rule is marked to be validated.
OnValidationCompleted(Object, ValidationCompletedEventArgs)
ReferenceEquals(Object, Object) static Determines whether the specified Object instances are the same instance. Inherited from Object.
RegisterRules(ITypeInfo) Adds validation rules of the class given as a parameter to the RuleSet.
ToString() Returns a string that represents the current object. Inherited from Object.
Validate(IObjectSpace, Object, ContextIdentifiers) Validates an object against RuleSet's rules with the given validation contexts, returns a result and throws a ValidationException if the validation fails.
Validate(IObjectSpace, Object, ContextIdentifiers, ValidationFailedDelegate) Validates an object against the RuleSet's rules with the given validation contexts, returns a result and throws a ValidationException if the validation fails.
ValidateAll(IObjectSpace, IEnumerable, ContextIdentifiers) Validates multiple objects against RuleSet's rules with the given validation contexts, returns a result and throws a ValidationException if the validation fails.
ValidateAll(IObjectSpace, IEnumerable, ContextIdentifiers, ValidationFailedDelegate) Validates multiple objects against RuleSet's rules with the given validation contexts, returns a result and throws a ValidationException if the validation fails.
ValidateAllTargets(IObjectSpace, IEnumerable) Silently (without raising the RuleSet.ValidationCompleted event and throwing the ValidationException) validates multiple targets and returns the result.
ValidateAllTargets(IObjectSpace, IEnumerable, ContextIdentifiers) Silently (without raising the RuleSet.ValidationCompleted event and throwing the ValidationException) validates multiple targets and returns the result.
ValidateRule(IObjectSpace, IRule, Object) static Checks a rule on a target and returns a result.
ValidateTarget(IObjectSpace, Object, ContextIdentifiers) Silently validates an object (without raising the RuleSet.ValidationCompleted event and throwing the ValidationException) and returns a result.
ValidateTarget(IObjectSpace, Object, ReadOnlyCollection<IRule>, ContextIdentifiers)

Events

Name Description
CustomIsEmptyValue static Occurs when the RuleSet.IsEmptyValue method is executed to determine whether or not the property value is considered empty.
CustomIsEmptyValueType static
CustomNeedToValidateRule static Occurs when the validation system determines whether or not a rule should be validated.
CustomValidateRule static Occurs when a rule is being validated.
RuleValidated static Occurs after the validation of a rule is complete.
ValidationCompleted Occurs after validation of an entire RuleSet is complete.
See Also