public async Task InvokeAsync(ConsoleRequestContext context, RequestDelegate next) { CommandSeed commandSeed = commandPool.GetMatchingCommand(context.Arguments); ICommandModel commandModel = commandSeed.CreateModel(commandModelFactory); object commandView = commandSeed.CreateView(commandViewFactory); bool isLongCommandView = IsLongCommandView(commandView); if (isLongCommandView) { await ExecuteLongCommand(commandModel, commandView, context); } else { await ExecuteCommand(commandModel, commandView, context); } if (next != null) { await next.Invoke(context); } }