using System.Collections.Generic;
public static void Main()
var normalCommand1 = new Command1();
var normalCommand2 = new Command2();
var scheduledCommand1 = new Command3(DateTimeOffset.UtcNow.AddDays(3));
var commandList = new List<WorkflowCommand>()
foreach (var command in commandList)
if (command is ScheduledWorkflowCommand)
var scheduledCommand = (ScheduledWorkflowCommand)command;
Console.WriteLine($"Scheduled Command: {scheduledCommand.StepDisplayName} scheduled {scheduledCommand.ExecuteAfter.Humanize()}");
else if (command is WorkflowCommand)
Console.WriteLine($"Normal Command: {command.StepDisplayName}");
public abstract class WorkflowCommand : IRequest<Result>
public WorkflowCommand(string stepDisplayName) => this.StepDisplayName = stepDisplayName;
public string StepDisplayName { get; }
public class Command1 : WorkflowCommand
public Command1() : base("Step 1")
public class Command2 : WorkflowCommand
public Command2() : base("Step 2")
public abstract class ScheduledWorkflowCommand : WorkflowCommand
public ScheduledWorkflowCommand(string displayname, DateTimeOffset executeAfter)
: base($"Scheduled Command - {displayname}")
this.ExecuteAfter = executeAfter;
public DateTimeOffset ExecuteAfter { get; set; }
public WorkflowCommand Command { get; }
public class Command3 : ScheduledWorkflowCommand
public Command3(DateTimeOffset executeAfter)
: base("Step 3", executeAfter)