public static SyncProcessDelegate NullMiddlewareMethod(SyncProcessDelegate next) { SyncProcessDelegate retval; Console.WriteLine("{1} (before GetMiddlewareChain): '{0}'", nameof(NullProcessor), nameof(NullMiddlewareMethod)); retval = SyncProcessorClosure.GetMiddlewareChain(NullProcessorMethod, next); Console.WriteLine("{1} (after GetMiddlewareChain): '{0}'", nameof(NullProcessor), nameof(NullMiddlewareMethod)); return(retval); }
public SyncProcessDelegate Build() { SyncProcessDelegate process = (context, configuration, channel) => channel; // simply return original channel unmodified foreach (Func <SyncProcessDelegate, SyncProcessDelegate> component in this.Components.Reverse()) { process = component(process); } return(process); }
private SyncProcessorClosure(SyncProcessToNextDelegate processToNext, SyncProcessDelegate next) { if ((object)processToNext == null) { throw new ArgumentNullException(nameof(processToNext)); } if ((object)next == null) { throw new ArgumentNullException(nameof(next)); } this.processToNext = processToNext; this.next = next; }
protected abstract ISyncChannel ProcessInternal(ISyncContext context, RecordConfiguration configuration, ISyncChannel channel, SyncProcessDelegate next);
public ISyncChannel Process(ISyncContext context, RecordConfiguration configuration, ISyncChannel channel, SyncProcessDelegate next) { ISyncChannel newChannel; if ((object)context == null) { throw new ArgumentNullException(nameof(context)); } if ((object)configuration == null) { throw new ArgumentNullException(nameof(configuration)); } if ((object)channel == null) { throw new ArgumentNullException(nameof(channel)); } newChannel = this.ProcessInternal(context, configuration, channel, next); return(newChannel); }
private static ISyncChannel NullProcessorMethod(ISyncContext context, RecordConfiguration configuration, ISyncChannel channel, SyncProcessDelegate next) { ISyncChannel newChannel; if ((object)context == null) { throw new ArgumentNullException(nameof(context)); } if ((object)configuration == null) { throw new ArgumentNullException(nameof(configuration)); } if ((object)channel == null) { throw new ArgumentNullException(nameof(channel)); } Console.WriteLine("{1} (before next) processor: '{0}'", nameof(NullProcessor), nameof(NullProcessorMethod)); if ((object)next != null) { newChannel = next(context, configuration, channel); } else { newChannel = channel; } Console.WriteLine("{1} (after next) processor: '{0}'", nameof(NullProcessor), nameof(NullProcessorMethod)); return(newChannel); }
public static SyncProcessDelegate GetMiddlewareChain(SyncProcessToNextDelegate processToNext, SyncProcessDelegate next) { if ((object)processToNext == null) { throw new ArgumentNullException(nameof(processToNext)); } if ((object)next == null) { throw new ArgumentNullException(nameof(next)); } return(new SyncProcessorClosure(processToNext, next).Transform); }