partial void OnVisit(IValidatableWithSeverity p)
        {
            var pp = p as ITreeConfigNode;

            if (pp == null)
            {
                pp = (ITreeConfigNode)this.parent;
            }
            else
            {
                this._level++;
            }
            this.parent = p;
            if (this._logger != null)
            {
                this._logger.LogInformation(string.Empty.PadRight(this._level, ' ') + pp.GetType().Name + ": " + pp.Name);
            }
            p.ValidationCollection.Clear();
            p.CountErrors   = 0;
            p.CountWarnings = 0;
            p.CountInfos    = 0;

            p.Validate();

            foreach (var t in p.ValidationCollection)
            {
                // t.Model = node;
                this.AddMessage(pp, t);
            }
        }
Ejemplo n.º 2
0
 public void ValidateSubAndCollectErrors(IValidatableWithSeverity sub)
 {
     sub.Validate();
     //foreach (var t in sub.ValidationCollection)
     //{
     //    this.ValidationCollection.Add(t);
     //}
     this.ValidationCollection.AddRange(sub.ValidationCollection);
 }
 partial void OnVisitEnd(IValidatableWithSeverity p)
 {
     if (p is ITreeConfigNode)
     {
         var pp = p as ITreeConfigNode;
         if (this._logger != null)
         {
             this._logger.LogInformation(string.Empty.PadRight(this._level, ' ') + pp.GetType().Name + ": " + pp.Name);
         }
         this._level--;
     }
 }
        private void ValidateSubAndCollectErrors(ITreeConfigNode p, IValidatableWithSeverity sub)
        {
            if (p is ICanGoLeft || p is ICanGoRight) // is visible in the tree
            {
                this.node = p;
            }

            sub.Validate();
            foreach (var t in sub.ValidationCollection)
            {
                t.Model = this.node;
                this.AddMessage(p, t);
            }
        }
 partial void OnVisitEnd(IValidatableWithSeverity p);