/// <summary> /// Asynchronously invokes the rule. /// </summary> /// <returns> /// List of <see cref="System.ComponentModel.DataAnnotations.ValidationResult"/> if the rule fails execution. /// </returns> /// <param name="businessRule">A rule that implements <see cref="IRule"/>.</param> public static Task <IEnumerable <ValidationResult> > ValidateAsync(this IRule businessRule) { return(IRuleExtensions.ValidateAllAsync(businessRule.ToArray(), null)); }
/// <summary> /// Synchronously invokes the rule. /// </summary> /// <returns> /// List of <see cref="System.ComponentModel.DataAnnotations.ValidationResult"/> if the rule fails execution. /// </returns> /// <param name="businessRule">A rule that implements <see cref="ISynchronousRule"/>.</param> public static IEnumerable <ValidationResult> Validate(this ISynchronousRule businessRule) { return(IRuleExtensions.ValidateAll(new [] { businessRule }, null)); }
/// <summary> /// Asynchronously invokes the rules. /// </summary> /// <returns> /// List of <see cref="System.ComponentModel.DataAnnotations.ValidationResult"/> for any failed rules. /// </returns> /// <param name="businessRules">An enumerable list of <see cref="IRule"/> to execute.</param> public static Task <IEnumerable <ValidationResult> > ValidateAllAsync(this IEnumerable <IRule> businessRules) { return(IRuleExtensions.ValidateAllAsync(businessRules, null)); }
/// <summary> /// Synchronously invokes the rules. /// </summary> /// <returns> /// List of <see cref="System.ComponentModel.DataAnnotations.ValidationResult"/> for any failed rules. /// </returns> /// <param name="businessRules">An enumerable list of <see cref="ISynchronousRule"/> to execute.</param> public static IEnumerable <ValidationResult> ValidateAll(this IEnumerable <ISynchronousRule> businessRules) { return(IRuleExtensions.ValidateAll(businessRules, null)); }