How to do Module Services in a layered Module?

Sep 7, 2007 at 10:39 PM
I understand the Modular architecture enough to really like it. But I'm missing a large piece of understanding in how to handle "modularity within a module".

Specifically, I'm trying to build my system in such a way that it can be used as a framework for various customer implementations of "the system". Being able to swap out modules is great, but I'd like to go further and allow modules to be customized more easily by allowing their component parts to be swapped out individually.

Let's say I have a Business Module called MyModule. And I want to layer that module by having separate projects -- for instance, MyModule.Module and MyModule.DataAccess. I want the DataAccess component to be able to be interchangeable, so I don't want to tightly couple the code in MyModule with the stuff in the DataAccess project. I'm doing this right now by giving the DataAccess project a ModuleInitializer and registering a MyModuleDataService service, and then consuming that service in the main module. But this essentially makes the DataAccess project a full-on module unto itself, right?

Is there a way to register the MyModuleDataService service in the module container for MyModule outside of the MyModule project? Is this a good thing to be trying to do? Or does the "component" dividing line have to be drawn at the module level? I hope that makes sense.

Sep 8, 2007 at 7:38 AM
Hi Chris

Registration happens through the composition container. If you want the registration logic to sit in a different assembly, then you can as long as it you pass it a reference to the module's composition container. Once it has that reference, it can register services for that container.

Does this help?
Sep 10, 2007 at 8:41 PM
Edited Sep 10, 2007 at 8:43 PM
Well, while I'm not sure how to "pass [a different assembly] a reference to the module's composition container" the more important question was "Is this a good thing to be trying to do?" I'm looking for architectural guidance as much as anything.