Business Module service as a Global service

Dec 3, 2008 at 4:51 PM
Edited Dec 3, 2008 at 4:51 PM
Hi

I have a Business module service [which need to be used by other business module also] . I have registered this service as a Global Service inorder to make it available to other business module.
Is this approach right?
I tried adding this as a module service in each business module,but could not add this since I cannot access the actual class[I have the access to only interface of  other module.]
Please help.

Developer
Dec 4, 2008 at 11:20 AM

Hi

 

Yes, you need to register your service in the AddGlobalServices method of the ModuleInitializer class. Make sure to place the service interface in a common project (like in a Module.Inteface project). Using a separate project for the public interface of the module, reduces the coupling between the business module and other modules in the application because modules reference the interface project instead of the module assembly.

 

Note: You can also extend the WebClientApplication class and override the AddRequiredServices method to register global services. Use this option to add global infrastructure services or to replace initialization services, such as the ModuleLoaderService service.

 

Take into account that every module has its own Composition Container. This container is mapped to the module using  the virtualPath attribute set in the module’s Web.config. If you add services in the AddModuleServices method of the ModuleInitializer class, these services will only be available in that module’s Composition Container.

 

For more information related to registering and using services you could check the following topic in the WCSF documentation:

·         How to: Register and Use Services

 

Please let me know if this helps.

 

Mariano Converti

http://blogs.southworks.net/mconverti

Dec 4, 2008 at 2:47 PM
Thanks  Mariano ,it helped.