Пример #1
0
        public Task<CommandHandlingResult> InterceptAsync(ICommandInterceptionContext context)
        {
            Intercepted = true;
            InterceptionTimestamp = DateTime.UtcNow;

            return context.InvokeNextAsync();
        }
Пример #2
0
 public async Task <CommandHandlingResult> InterceptAsync(ICommandInterceptionContext context)
 {
     return(await CommonInterceptionLogic.InterceptAsync(
                _messageCancellationRegistry,
                _messageCancellationService,
                _log,
                context.Command,
                context.HandlerObject,
                context.InvokeNextAsync));
 }
Пример #3
0
        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());
        }
Пример #7
0
 public Task <CommandHandlingResult> InterceptAsync(ICommandInterceptionContext context)
 {
     return(Task.FromResult(_actualHandler.Invoke(context.Command, context.EventPublisher)));
 }