Ejemplo n.º 1
0
        private Type GetCommandType(IOwinContext context)
        {
            var commandName = commandNameResolver.GetCommandName(context.Environment);

            if (string.IsNullOrWhiteSpace(commandName))
            {
                throw new UnidentifiableCommandException();
            }

            var commandType = commandRegistry.GetCommandType(commandName);

            if (commandType == null)
            {
                throw new UnknownCommandException(commandName);
            }

            return(commandType);
        }
Ejemplo n.º 2
0
        public object Construct(string commandName)
        {
            if (string.IsNullOrWhiteSpace(commandName))
            {
                throw new UnidentifiableCommandException();
            }

            var commandType = commandRegistry.GetCommandType(commandName);

            if (commandType == null)
            {
                throw new UnknownCommandException(commandName);
            }

            var command = Create(commandType);

            if (command == null)
            {
                throw new EmptyCommandBodyException(commandType);
            }

            return(command);
        }