So I have been reading about DDD for some time and trying to figure out the best approach on several issues.
I tend to agree that I should design my model in a persistent agnostic manner. And that repositories should load and persist my models in valid states.
But are these approaches realistic practically? I mean its normal for a model to hold a reference to a collection of another type. Persisting that model should mean persist the entire collection. Fine. But do I really need to load the entire collection every time I load the model? Probably not.
So I can have specialized repositories. Some that load maybe a subset of the object graph via DTOs and others that load the entire object graph. But when do I use which? If I have DTOs, what's stopping client code from directly calling them and completely bypassing the model?
I can have mappers and factories to create my models from DTOs maybe? But depending on the design of my models that might not always work. Or it might not allow my models to be created in a valid state.
EDIT 1: Aside from lazy/eager loading and using a DI framework to inject repositories in my models, what is another approach?
What's the correct approach here?