Exemplo n.º 1
0
        public ToUpperOp(string name) : base(name)
        {
            var ebc = new ToUpperEBC();

            ebc.Result += _ =>
            {
                var continueWith = (Action <IMessage>)Thread.GetData(
                    Thread.GetNamedDataSlot("continueWith")
                    );
                continueWith(new Message(base.Name, _));
            };

            _adapter = (input, continueWith, unhandledException) =>
            {
                Thread.AllocateNamedDataSlot("continueWith");
                Thread.SetData(Thread.GetNamedDataSlot("continueWith"),
                               continueWith);
                try
                {
                    ebc.Process((string)input.Data);
                }
                finally
                {
                    Thread.FreeNamedDataSlot("continueWith");
                }
            };
        }
Exemplo n.º 2
0
        public ToUpperOp(string name)
            : base(name)
        {
            var ebc = new ToUpperEBC();
            ebc.Result += _ =>
                              {
                                  var continueWith = (Action<IMessage>)Thread.GetData(Thread.GetNamedDataSlot("continueWith"));
                                  continueWith(new Message(base.Name, _));
                              };

            _adapter = (input, continueWith, unhandledException) =>
                           {
                               Thread.AllocateNamedDataSlot("continueWith");
                               Thread.SetData(Thread.GetNamedDataSlot("continueWith"), continueWith);
                               try
                               {
                                   ebc.Process((string) input.Data);
                               }
                               finally
                               {
                                   Thread.FreeNamedDataSlot("continueWith");
                               }
                           };
        }