public void Run()
        {
            _handler = HandlerFactory.Instance.GetHandler(_handlerInfo);

            if (_handler != null)
            {
                _runner = HandlerRunnerFactory.Instance.GetAsync(_handlerInfo.HandlerType, _context.Request.HttpMethod);
                _runner.Start(_handler.Handler, _context).ContinueWith(RunContinuation);
            }
            else
            {
                throw new InvalidOperationException("Could not create handler handler.");
            }
        }
Beispiel #2
0
 private void RunContinuation(Task<Status> t, IScopedHandler handler, IContext context, AsyncRunner runner)
 {
     try
     {
         if (t.IsFaulted && t.Exception != null)
         {
             new ErrorHelper(context).WriteError(t.Exception.InnerException);
         }
         else
         {
             try
             {
                 runner.End(handler.Handler, context, t.Result);
             }
             catch (Exception ex)
             {
                 new ErrorHelper(context).WriteError(ex);
             }
         }
     }
     finally
     {
         handler.Dispose();
     }
 }