I have two dependent modules, e.g. BLModule is using AuditTrailModule. To run my application, both modules have to be loaded, but for me it's irrelevant in what order they are initialized. Now I have two possibilities:
Solution 1: I can either set the dependency:
public class BLModule : IModule
Now, in my bootstrapper, I can add the BLModule to my module catalog and both modules are loaded due to the dependency.
Solution 2: Alternatively, I can remove the module dependency attribute and instead in my application add the BLModule and the AuditTrailModule to the module
The MSDN documentation says: "Modules may depend on other modules. If Module A depends on Module B, Module B must be initialized before Module A." As said, in our case it's
only necessary that both modules are loaded, but the order of initialization is irrelevant.
Solution 1 has the advantage that our customer doesn't need to care about the AuditTrailModule, it get's automatically loaded when the BLModule is loaded. On the other hand, Solution 2 has the advantage that if our customer would want to implement its own
AuditTrailModule, he could just do so an load it to the module catalog (the Solution 1 would unnecessarily still load the "old" AuditTrailModule).
Is there a guidance / best practice when to use dependencies? Should it be used to get the "dependent" modules automatically loaded, or should it only be used when the order of initialization matters?
Thanks for any help