Example #1
0
        public CommandResult Handle(JsonCommandRequest command)
        {
            var contentAsKeyValues = _serializer.GetKeyValuesFromJson(command.Content).ToDictionary(k => k.Key.ToPascalCase(), k => k.Value);
            var commandRequest     = new CommandRequest(command.CorrelationId, command.Type, contentAsKeyValues);

            var result = _commandCoordinator.Handle(commandRequest);

            return(result);
        }
Example #2
0
        public CommandResult Handle(JsonCommandRequest command)
        {
            try
            {
                var contentAsKeyValues = _serializer.GetKeyValuesFromJson(command.Content).ToDictionary(k => k.Key.ToPascalCase(), k => k.Value);
                var commandRequest     = new CommandRequest(command.CorrelationId, command.Type, contentAsKeyValues);

                _commandContextConnectionManager.Register(Context.ConnectionId, command.CorrelationId);
                var commandResult = _commandCoordinator.Handle(commandRequest);
                return(commandResult);
            }
            catch (Exception ex)
            {
                return(new CommandResult {
                    Exception = ex,
                    ExceptionMessage = string.Format("Exception occured of type '{0}' with message '{1}'. StackTrace : {2}", ex.GetType().Name, ex.Message, ex.StackTrace)
                });
            }
        }