Esempio n. 1
0
        /// <summary>
        /// Determines if the message handler applies based on the assigned dispatcher
        /// rules and the dispatcher rule type.
        /// </summary>
        /// <param name="message">The message</param>
        /// <returns>Returns True if the event handler should be called.</returns>
        public bool IsMatch(IMessage message)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            if (!DispatchRuleTypes.Any())
            {
                return(true);
            }

            return(RuleApplyType == RuleApplyTypes.All ? DispatchRules.All(r => r.IsMatch(message))
                : DispatchRules.Any(r => r.IsMatch(message)));
        }
        /// <summary>
        /// Determines if the message handler applies based on the assigned dispatcher
        /// rules and the dispatcher rule type.
        /// </summary>
        /// <param name="message">The message</param>
        /// <returns>Returns True if the event handler should be called.</returns>
        public bool IsMatch(IMessage message)
        {
            Check.NotNull(message, nameof(message));

            if (!DispatchRuleTypes.Any())
            {
                return(true);
            }

            if (RuleApplyType == RuleApplyTypes.All)
            {
                return(DispatchRules.All(r => r.IsMatch(message)));
            }

            return(DispatchRules.Any(r => r.IsMatch(message)));
        }