public Task<CommandHandlingResult> InterceptAsync(ICommandInterceptionContext context) { Intercepted = true; InterceptionTimestamp = DateTime.UtcNow; return context.InvokeNextAsync(); }
public async Task <CommandHandlingResult> InterceptAsync(ICommandInterceptionContext context) { var commandType = context.Command.GetType(); var result = await _cqrsAwaiter.InterceptAsync(commandType, async() => { return(await context.InvokeNextAsync()); }); return(result); }
public async Task <CommandHandlingResult> InterceptAsync(ICommandInterceptionContext context) { try { return(await context.InvokeNextAsync()); } catch (InvalidAggregateStateException ex) { _log.Warning($"{nameof(InvalidAggregateStateException)} handled", ex); return(CommandHandlingResult.Fail(TimeSpan.FromSeconds(10))); } }
/// <inheritdoc cref="ICommandInterceptor"/> public Task <CommandHandlingResult> InterceptAsync(ICommandInterceptionContext context) { if (_customLoggingActionsMap.TryGetValue(context.Command.GetType(), out var customLoggingAction)) { customLoggingAction?.Invoke(_defaultLogger, context.HandlerObject, context.Command); } else { _defaultLogger.Log(context.HandlerObject, context.Command); } return(context.InvokeNextAsync()); }
/// <inheritdoc cref="ICommandInterceptor"/> public Task <CommandHandlingResult> InterceptAsync(ICommandInterceptionContext context) { _commandLogger.Log(context.HandlerObject, context.Command); return(context.InvokeNextAsync()); }