I believe that the main objective of the Using
method is to simplify the creation of the handlers. Let's take for example the
and the AddReminderToVehicle
handler. If you want to create an instance of the handler you will find that its constructor needs two parameters, which means that the
will need to know those parameters in order to create the handler. What is more, the controller requires several other handlers as well, so it will need to know the parameters to construct all of the handlers it uses.
In order to avoid this, the controllers delegate the creation of the handlers to the
. Finally, by encapsulating the logic to retrieve the handler from the
in the Using
method, the syntax of the controller becomes simpler and easier to read.