示例#1
0
        /// <summary>
        /// To process rules in suspended mode (for example, create several rules and start them up simultaneously). After completion of method operation all rules, attached to the container resume their activity.
        /// </summary>
        /// <param name="container">The rules container.</param>
        /// <param name="action">The action to be processed at suspended rules. For example, to add several rules simultaneously.</param>
        public static void SuspendRules(this IMarketRuleContainer container, Action action)
        {
            if (container == null)
            {
                throw new ArgumentNullException(nameof(container));
            }

            if (action == null)
            {
                throw new ArgumentNullException(nameof(action));
            }

            container.SuspendRules();

            try
            {
                action();
            }
            finally
            {
                container.ResumeRules();
            }
        }
示例#2
0
 /// <summary>
 /// To process rules in suspended mode (for example, create several rules and start them up simultaneously). After completion of method operation all rules, attached to the container resume their activity.
 /// </summary>
 /// <param name="action">The action to be processed at suspended rules. For example, to add several rules simultaneously.</param>
 public static void SuspendRules(Action action)
 {
     DefaultRuleContainer.SuspendRules(action);
 }