Exemplo n.º 1
0
        public void Run(PerformContext context, IJobPerformer performer)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            if (performer == null)
            {
                throw new ArgumentNullException("performer");
            }

            var filterInfo = GetFilters(context.Job);

            try
            {
                PerformJobWithFilters(context, performer, filterInfo.ServerFilters);
            }
            catch (OperationCanceledException)
            {
                throw;
            }
            catch (Exception ex)
            {
                var exceptionContext = new ServerExceptionContext(context, ex);
                InvokeServerExceptionFilters(exceptionContext, filterInfo.ServerExceptionFilters);

                if (!exceptionContext.ExceptionHandled)
                {
                    throw;
                }
            }
        }
Exemplo n.º 2
0
        public void Run(PerformContext context, IJobPerformer performer)
        {
            if (context == null) throw new ArgumentNullException("context");
            if (performer == null) throw new ArgumentNullException("performer");

            var filterInfo = GetFilters(context.Job);

            try
            {
                PerformJobWithFilters(context, performer, filterInfo.ServerFilters);
            }
            catch (OperationCanceledException)
            {
                throw;
            }
            catch (Exception ex)
            {
                var exceptionContext = new ServerExceptionContext(context, ex);
                InvokeServerExceptionFilters(exceptionContext, filterInfo.ServerExceptionFilters);

                if (!exceptionContext.ExceptionHandled)
                {
                    throw;
                }
            }
        }
Exemplo n.º 3
0
 private static void InvokeServerExceptionFilters(
     ServerExceptionContext context,
     IEnumerable <IServerExceptionFilter> filters)
 {
     foreach (var filter in filters.Reverse())
     {
         filter.OnServerException(context);
     }
 }
Exemplo n.º 4
0
 private static void InvokeServerExceptionFilters(
     ServerExceptionContext context,
     IEnumerable<IServerExceptionFilter> filters)
 {
     foreach (var filter in filters.Reverse())
     {
         filter.OnServerException(context);
     }
 }