Exemplo n.º 1
0
        /// <summary>
        ///   Exit the specified <paramref name="scope" /> .
        /// </summary>
        /// <remarks>
        ///   If there are nested scopes within the specified <paramref name="scope" /> , those will be exited as well.
        /// </remarks>
        /// <param name="scope"> The scope to exit </param>
        protected static void ExitScope(ValidationScope scope)
        {
            if (!ActiveScopes.Contains(scope))
            {
                return;
            }

            ValidationScope popped;

            do
            {
                popped = ActiveScopes.Pop();
            } while (scope != popped);
        }
Exemplo n.º 2
0
        /// <summary>
        ///   Initializes a new instance of the <see cref="ValidationScope" /> class.
        /// </summary>
        public ValidationScope(bool enter = true)
        {
            if (activeScopes != null && activeScopes.Count > 0)
            {
                parent      = ActiveScopes.Peek();
                evaluations = parent.evaluations;
            }
            else
            {
                evaluations = new ConcurrentBag <RuleEvaluation>();
            }

            if (enter)
            {
                EnterScope(this);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 ///   Enters the specified <paramref name="scope" /> .
 /// </summary>
 /// <param name="scope"> The scope. </param>
 protected static void EnterScope(ValidationScope scope)
 {
     ActiveScopes.Push(scope);
 }