Currently I'm using Autofac
for IoC and at two composition roots (one for the front-end and one for the back-end) I register and resolve the components spanned across Service
, Business
and Data
layers.
As of now I have a single one like 'AccountingModule'. Now I'm going to add several new Modules to the application, with a name like InventoryModule
, ...
My question is should I split each module classes among the layers (Solution 1) or have all layers separately for each module (Solution 2)
Solution 1:
Service Layer
(AccountingMoudle, InventoryModule, ...)
Business Layer
(AccountingMoudle, InventoryModule, ...)
Data Layer
(AccountingModule, InventoryModule, ...)
or
Solution 2:
AccountingModule
(
Service Layer,
Business Layer,
Data Layer
)
InventoryModule
(
Service Layer,
Business Layer,
Data Layer
)
Edit 1
+-----------------------------+ +----------------------------+
+--+AccountingServiceComponent +-+InventoryServiceComponent
| Weak Dependency |
+--+AccountingBusinessComponent <------------------+ +-+InventoryBusinessComponent
| |
+--+AccountingDataComponent +-+InventoryDataComponent
+ +
+-+ GetDocumentByID(int id) +--+GetProductByID(int id)
| |
+-+ SaveDocument(Document d) +--+SaveProduct(Product p)
Edit 2 Architecture: