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); }
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); }