Пример #1
0
 /// <summary> Collects all rule messages associated with the
 /// specified <paramref name="items"/> </summary>
 /// <typeparam name="TItem">The type of the item to run the rules against.</typeparam>
 /// <param name="items">The item to run the rules against.</param>
 /// <param name="name">The name of the scope.</param>
 /// <param name="rules">The rules to execute.</param>
 /// <returns>read-only collection of <see cref="RuleMessage"/></returns>
 public static RuleMessages GetMessagesForMany <TItem>(IEnumerable <TItem> items, string name, params Rule <TItem>[] rules)
 {
     if (name == null)
     {
         throw new ArgumentNullException("name");
     }
     return(SimpleScope.GetMessages(name, scope => scope.ValidateInScope(items, rules)));
 }
Пример #2
0
        /// <summary>
        /// Gets the messages created by action being executed against the scope.
        /// </summary>
        /// <param name="name">The name for the scope.</param>
        /// <param name="scopeAction">The scope action.</param>
        /// <returns>read-only collection of <see cref="RuleMessage"/></returns>
        public static RuleMessages GetMessages([NotNull] string name, [NotNull] Action <IScope> scopeAction)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (scopeAction == null)
            {
                throw new ArgumentNullException("scopeAction");
            }

            return(SimpleScope.GetMessages(name, scopeAction));
        }
Пример #3
0
 /// <summary> Collects all rule messages associated with the
 /// specified <paramref name="item"/> </summary>
 /// <typeparam name="TItem">The type of the item to run the rules against.</typeparam>
 /// <param name="item">The item to run the rules against.</param>
 /// <param name="rules">The rules to execute.</param>
 /// <returns>read-only collection of <see cref="RuleMessage"/></returns>
 public static RuleMessages GetMessages <TItem>(TItem item, params Rule <TItem>[] rules)
 {
     return(SimpleScope.GetMessages(typeof(TItem).Name, scope => scope.ValidateInScope(item, rules)));
 }