public void Apply(ApplyStateContext context, IWriteOnlyTransaction transaction) { var enqueuedState = context.NewState as EnqueuedState; if (enqueuedState == null) { throw new InvalidOperationException( $"`{typeof (Handler).FullName}` state handler can be registered only for the Enqueued state."); } transaction.AddToQueue(enqueuedState.Queue, context.BackgroundJob.Id); }
public void Apply(ApplyStateContext context, IWriteOnlyTransaction transaction) { var enqueuedState = context.NewState as EnqueuedState; if (enqueuedState == null) { throw new InvalidOperationException(String.Format( "`{0}` state handler can be registered only for the Enqueued state.", typeof(Handler).FullName)); } transaction.AddToQueue(enqueuedState.Queue, context.JobId); }