Quantcast
Channel: patterns & practices: Project Silk
Viewing all articles
Browse latest Browse all 93

New Post: IServiceLocator in project Silk

$
0
0
Hi,

I believe that the main objective of the Using method is to simplify the creation of the handlers. Let's take for example the ReminderController 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 ReminderController 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 ServiceLocator. Finally, by encapsulating the logic to retrieve the handler from the ServiceLocator in the Using method, the syntax of the controller becomes simpler and easier to read.

Thanks,

Damian Cherubini
http://blogs.southworks.net/dcherubini

Viewing all articles
Browse latest Browse all 93

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>