Global Services defined in Business Modules

Topics: Web Client Software Factory, Project Management Forum, User Forum
May 9, 2007 at 3:37 AM
Hi all,

According to WCSF documentation, Business Modules are independent from one another and do not expose functionality to other modules.
Now, when a Business Module is created with the guidance package, it creates a initialization class in the class library project. The initialization class has the AddGlobalServices method that allows to define the services that will be visible to any module.

What is the purpose of the AddGlobalServices method since the services defined in the Business Module cannot be exposed?

May 9, 2007 at 9:14 AM
Interesting question, and one I asked myself too. I think my view would be "it is there in case you want to use it" - but I would always advise my devs to use a foundation module to host global services.

I have tried and tried and can't really think of a justifiable solution when I'd register a global service in a business module. I started on the route considering a general menu system kind of business module, perhaps with some basic web site infrastructure elements in it... but I just kept coming back to putting this stuff in Shell and registering the services in a foundation module.

I suppose you could register global services in the Shell module, which I guess is just a specialised business module?

Anyone else?

May 9, 2007 at 9:36 AM
I thought about this myself, too. Here is how we're using it.

Sometimes you need to share some services with other modules, like in the following case. Suppose you have and application with two modules (Invoincing and Stocks) that can be optionally installed. Every time you have a new invoince, you need to check if you have the Stocks module in order to see if you need to make a stock movement. To do this, you check in the Shell for the Stock Service (registered as global from the Stocks module). If you have it, create the new movement. If not, carry on as usual. This takes care of why you need global services, IMO at least.

Now my problem with it. To do this, you need to have the service interface for all the available services in the Shell, which 1) may not be very practical and 2) break the module independence.

Maybe someone will come along to further add to this?

May 10, 2007 at 2:51 AM
IMHO, you wouldn't register a global service in a business module. You would register it in a foundation module or the Shell Module.

I think there is going to be a wide variety of implementations of the WCSF and what it means to be a business module. I typically treat the business modules as separate applications ( blog, commerce, forums ) that can be XCOPIED up to the website with no dependency on one another. The Shell Module defines the overall shell of the UI and default global services that can be overriden in business modules ( applications ). Pluggable components / services per application as mentioned by Pedro are dealt within the business module not within the Shell. If possible, I would also use a generic interface like IPlugin or something so that pluggable functionality per application is indeed pluaggable and doesn't require an interface creation. Similar to how the WCSF finds and treats modules.




David Hayden
Microsoft MVP C#