Skip to content

Command Router

Iuga Alexandru edited this page May 16, 2023 · 1 revision

It is responsible for instantiating and executing the appropriate ICommand object.

Input Data

For its job, the router needs two types of data:

  • available commands
    • also known as Command Metadata Model.
    • a list with information about all the classes that represent a command.
    • obtained using reflection from the assembly provided at setup time.
  • command request
    • Also known as Command Request Model.
    • Contains all the data from the user's command line request.

Execution

What the Command Router remains to do is:

  1. identify command - Search in the list of available commands for the one specified by the Command Request Model.

  2. instantiate command

    • populate command parameters - This is done based on the metadata with values from the text command.
  3. execute command

Result

  • A ICommand instance which is immediately executed.
Clone this wiki locally