示例#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;
                }
            }
        }
        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;
                }
            }
        }
示例#3
0
 private static void InvokeServerExceptionFilters(
     ServerExceptionContext context,
     IEnumerable <IServerExceptionFilter> filters)
 {
     foreach (var filter in filters.Reverse())
     {
         filter.OnServerException(context);
     }
 }
 private static void InvokeServerExceptionFilters(
     ServerExceptionContext context,
     IEnumerable<IServerExceptionFilter> filters)
 {
     foreach (var filter in filters.Reverse())
     {
         filter.OnServerException(context);
     }
 }