So i've been looking to impliment a VERY simple command interface for a services so that http cmds can be sent to it to control it.
The part im struggling with is the best way to implement the commands, which will be based on the route. I've seen a lot on the command pattern which makes sense, but there is one thing im trying to modify. In all cases there is a dictionary which has the commands, is there some way to get rid of the dictionary and, for example, look at all static methods in a class? Im sure this can be done with reflection but i have yet to see an example of it, and when ever i look for the command pattern and reflection most people say to stay away from it.
my main goal is to make sure that if someone adds a command they dont forget to add it to the dictionary, I know i want all static methods to respond to routes
is this a good idea or should i say screw it and just stick to the normal pattern?
Aucun commentaire:
Enregistrer un commentaire