public async Task InvokeAsync(ConsoleRequestContext context, RequestDelegate next) { try { if (next != null) { await next.Invoke(context); } } catch (Exception ex) { CustomConsole.WriteLineError(ex.Message); log.WriteError(ex); await Task.FromResult(null as object); } }
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); } }
public async Task InvokeAsync(ConsoleRequestContext context, RequestDelegate next) { await next(context); }
private static async Task ExecuteCommand(ICommandModel commandModel, object commandView, ConsoleRequestContext context) { await commandModel.Execute(context.Arguments); if (commandView != null) { ExecuteView(commandView, commandModel); } }