Best practice for sub-services

Topics: CAB & Smart Client Software Factory
Nov 1, 2007 at 5:29 PM
In my current project using SCSF, I have the need to implement plugin based sub services to extend the base service in the Infrastructure.Library.
Let's take an email client for example:
The base service is TransportService (implements ITransportService) which handles send/receiving mails and rss, but it doesn't actual implement those, instead being a base service for extension.
The RSS module do the actual RSS download and translate into messages.
The Mail module do the actual Mail download/send and translate into messages.
New modules and be added later to support notes synchronizing or anything that can be translated into messages.

What is the best practice to implement this?
Nov 9, 2007 at 7:56 PM
Do you want to be able to interchange the RSS and Mail services during runtime, or are they different services that will be used for different functionallity?

If you want to be able to interchange them, you can register the one you will use with an interface (ITransportService in this case I guess) and have it injected in your application using the ServiceDependency attribute.

public ITransportService TransportService
If you want to use them for different actions, you can register both and obtain the one you need using dependency injection.

Let me know if this helps

Mariano Converti
Nov 10, 2007 at 5:56 AM
Thanks Mariano, I want to get a list of available services.
For example, when user comes to Create new Account, there should be RSS, email and maybe IRC. I think the best way is to have a central service for other services to register themself. So when then Create new Account dialog is needed, I get RSS and mail service instances from the main service.