/// <summary> /// Validates an instance of T against the rules defined in the specification and a SpecificationContainer. /// </summary> /// <remarks> /// This is useful when using a specification leverages other specifications for referenced types. The referenced /// types will be validated against their specifications contained in the SpecificationContainer. /// </remarks> /// <param name="instance">Instance of T to validate.</param> /// <param name="specificationContainer">The <see cref="SpecificationContainer"/></param> /// <returns><see cref="ValidationNotification"/></returns> public ValidationNotification Validate(T instance, SpecificationContainer specificationContainer) { lock (this) { var notification = new ValidationNotification(); PropertyValidators.Select(x => x.Validate(instance, specificationContainer, notification)); return(notification); } }
public bool Validate(object instance, SpecificationContainer specificationContainer, ValidationNotification notification) { lock (this) { foreach (var validator in PropertyValidators) { validator.Validate(instance, specificationContainer, notification); } return(notification.IsValid); } }
public abstract bool Validate(object instance, RuleValidatorContext parentRuleContexts, SpecificationContainer specificationContainer, ValidationNotification notification);
public abstract bool Validate(object instance, SpecificationContainer specificationContainer, ValidationNotification notification);