I have developed an application with following layers:
so when some DTO came back, I can map the DTO to business objects in the service layer and made my application to work with business objects. in that case when some function in lower layers executes it does not know any thing about the old object, so it become hard to handle and verify state changing and also there is class explosion for DTO adapters. on the other hand if dto is mapped to business object on the higher layers, when it came down, the lower layers did not know anything about the service which is called, so they can not unserstand how this dto must change the business objects(1 DTO might be used by different services in different ways)
so the question is what is the real solution??
From your specs, I'm kind of assuming you are aiming for a DDD based implementation
First, some assumptions to help map this to more common terminology: I assume your "Business Rules" layer is just used by your activity layer, and thus can be considered as part of the domain layer.
You mention business objects. I assume then that you have a domain layer. This might be your "activity layer". This should be the layer that knows how to update objects and return them to the service layer.
The service layer (or "application layer" in DDD terms) should be mapping the DTOs, and invoking domain services. MS has a decent diagram here. But basically the workflow should be:
There are of course many variations on this theme, but this should be your starting point.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With