Service that handles raising events

Topics: CAB & Smart Client Software Factory
Oct 3, 2007 at 6:51 PM

In working with CAB/SCSF, I've found that I have a need to raise the same events from multiple locations. I've tried searching the boards, but I haven't come across anything on this topic, so I wanted to pose this question to everyone. Would it be beneficial for me to create a service that handles raising common events? This way, I wouldn't have to put event definitions in every class that is raising that event and I can just call the service to do it for me.


Oct 5, 2007 at 3:44 PM
Edited Oct 5, 2007 at 3:46 PM
Hi Kyjan,

Adding a service to handle the firing of events will add you an extra layer of abstractions because objects will not fire events directly but they will invoke a method in a service who will in turn fire the events. This extra layer might be helpful in some cases (i.e.: if you want to execute some business logic before firing the event). The drawback of this approach is that you will have more elements in your solution and an extra level of indirection which might not always be worth. You should consider what is the best approach in your specific scenario.

Please let me know if this helps.

Mariano Converti