Esempio n. 1
0
 public void HandleDocument(Document document)
 {
     // тк документ хранит состояние, берем только нужный обработчик
     if (document.CurrentInstantion != this.InstansionType)
     {
         NextInstantion?.HandleDocument(document);
         return;
     }
     HandleDocumentInternal(document, () => MoveNext(document));
 }
Esempio n. 2
0
 private void MoveNext(Document document)
 {
     if (NextInstantion == null)
     {
         Console.WriteLine("End chain");
         return;
     }
     Console.WriteLine($"{this.GetType().Name} handled doc");
     document.CurrentInstantion = NextInstantion.InstansionType;
     NextInstantion.HandleDocument(document);
 }