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(); }
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(); }
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); }