public static Configuration OnSchedule <T>( this Configuration configuration, CommandSchedulingMiddleware <T> use) { if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } configuration.Container .AfterCreating <ICommandScheduler <T> >( scheduler => scheduler.UseMiddleware(use)); return(configuration); }
public static ICommandScheduler <T> UseMiddleware <T>( this ICommandScheduler <T> scheduler, CommandSchedulingMiddleware <T> middleware) => Create <T>(async delivery => await middleware( delivery, async d => await scheduler.Schedule(d)));