I created the infrastructure for a new project using DDD principles. I have storages that feed factories / hydrants in the domain. The application layer acts as a facade, modeling domain models for various viewing / editing models upon request.
Edit models are mapped and combined back into a domain model, which are verified using an unconditional check. Any errors are logged and reported to the user through the error service.
Everything works perfectly. Now I'm worried about the best way to create lists of these domain objects.
Several options come to mind:
1) Hydrate the full domain models, and then flatten them into a list. Domain models can be cached as an IEnumerable list. Then this collection is smoothed and pushed to the requesting view.
2) Create a “projection” object, which is an easy representation of the domain model. This would require almost no humidification, and it could be pulled through the domain level and displayed on the viewModel and displayed.
3) "bypass" the domain and have a service called from the application layer that generates IEnumerable. This would leave the domain clean.
I am worried that solution 1 will be difficult to display a list of domain members. While they will be tied, due to the search nature of the domain, there is no guarantee that the cache will do a lot of good.
Any advice on what would be the best option would be appreciated.
source share