Пример #1
0
        public async Task <TCommandResult> ExecuteAsync <TCommandResult>(ICommand <TCommandResult> command)
        {
            var handlerInstance = (dynamic)_handlerResolver.ResolveCommandHandler(command, typeof(ICommandHandler <,>));

            var result = await handlerInstance.HandleAsync((dynamic)command);

            if (result.IsSuccess)
            {
                return(result.Value);
            }

            throw new GeneralException(result.Error);
        }