예제 #1
0
        private static void PerformJobWithFilters(
            PerformContext context,
            IJobPerformer performer,
            IEnumerable <IServerFilter> filters)
        {
            var preContext = new PerformingContext(context);
            Func <PerformedContext> continuation = () =>
            {
                performer.Perform(context.Activator, context.CancellationToken);
                return(new PerformedContext(context, false, null));
            };

            var thunk = filters.Reverse().Aggregate(continuation,
                                                    (next, filter) => () => InvokePerformFilter(filter, preContext, next));

            thunk();
        }
예제 #2
0
        private static void PerformJobWithFilters(
            PerformContext context,
            IJobPerformer performer,
            IEnumerable<IServerFilter> filters)
        {
            var preContext = new PerformingContext(context);
            Func<PerformedContext> continuation = () =>
            {
                performer.Perform(context.Activator, context.CancellationToken);
                return new PerformedContext(context, false, null);
            };

            var thunk = filters.Reverse().Aggregate(continuation,
                (next, filter) => () => InvokePerformFilter(filter, preContext, next));
            
            thunk();
        }
예제 #3
0
        private object PerformJobWithFilters(
            PerformContext context,
            IJobPerformer performer,
            IEnumerable <IServerFilter> filters)
        {
            object result = null;

            var preContext = new PerformingContext(context);
            Func <PerformedContext> continuation = () =>
            {
                result = performer.Perform(_activator, context.JobExecutionContext);
                return(new PerformedContext(context, result, false, null));
            };

            var thunk = filters.Reverse().Aggregate(continuation,
                                                    (next, filter) => () => InvokePerformFilter(filter, preContext, next));

            thunk();

            return(result);
        }