Source/NFX.Wave/WorkDispatcher.cs
/// <summary>
/// Dispatches work into appropriate handler passing through filters.
/// The default implementation processes requests on the calling thread and disposes WorkContext deterministically
/// </summary>
Dispatches work into appropriate handler passing through filters.
The default implementation processes requests on the calling thread and disposes WorkContext deterministically
Dispatches work into appropriate handler passing through filters . The default implementation processes requests on the calling thread and disposes WorkContext deterministically
public virtual void Dispatch(WorkContext work)
        {
          WorkFilter filter = null;
          WorkHandler handler = null;
          try
          {
            var filters = m_Filters.OrderedValues.ToList().AsReadOnly();
            filter = filters.FirstOrDefault();
            if (filter!=null)
             filter.FilterWork(work, filters, 0);
            else
             InvokeHandler(work, out handler);
          }
          catch(Exception error)
          {
            work.LastError = error;
            HandleException(work, filter, handler, error);
          }
          finally
          {
            try
            {
               if (!work.NoDefaultAutoClose)
                  work.Dispose();
            }
            catch(Exception error)
            {
                HandleException(null, null, null, error);
            }
          }
        }
public virtual void Dispatch ( WorkContext work ) { WorkFilter filter = null ; WorkHandler handler = null ; try { var filters = m_Filters . OrderedValues . ToList ( ) . AsReadOnly ( ) ; filter = filters . FirstOrDefault ( ) ; if ( filter != null ) filter . FilterWork ( work , filters , 0 ) ; else InvokeHandler ( work , out handler ) ; } catch ( Exception error ) { work . LastError = error ; HandleException ( work , filter , handler , error ) ; } finally { try { if ( ! work . NoDefaultAutoClose ) work . Dispose ( ) ; } catch ( Exception error ) { HandleException ( null , null , null , error ) ; } } }
Dispatches work into appropriate handler passing through filters.
Dispatches work into appropriate handler passing through filters .
//captures context
work
WorkContext