I am new to DDD, having worked only in Transaction-Script apps with an anemic model, or just Big Balls of Mud, so please forgive any terminology I abuse.
I am trying to understand the proper separation between the domain model and the repository. What is the proper way to construct a domain object that is coming from a database, assuming the (incredibly simplified) need to query for objects by status (returns
enumerable), or by ID.
- Should a factory be building the objects, exposing methods for
GetByID(), using a DIed repository?
- Should a repository be called directly, knowing how to build a domain model from the DTO?
- Should the domain model have a constructor for get by ID, using a DIed repoistory to load the initial state, using some other (?) method for the list?
I am not really sure what the best way would be, and this question has an answer advocating each one (these are certainly mutuallu exclusive).