コード例 #1
0
 /// <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);
     }
 }
コード例 #2
0
 public bool Validate(object instance, SpecificationContainer specificationContainer, ValidationNotification notification)
 {
     lock (this)
     {
         foreach (var validator in PropertyValidators)
         {
             validator.Validate(instance, specificationContainer, notification);
         }
         return(notification.IsValid);
     }
 }
コード例 #3
0
 public abstract bool Validate(object instance, RuleValidatorContext parentRuleContexts, SpecificationContainer specificationContainer, ValidationNotification notification);
コード例 #4
0
 public abstract bool Validate(object instance, SpecificationContainer specificationContainer, ValidationNotification notification);