3 ms·
People have been using this for years. One of things I recommend is not using the repository pattern. You end up with a repo with lots of methods on and overly
by UK-Al05 7y ago
People have been using this for years. One of things I recommend is not using the repository pattern. You end up with a repo with lots of methods on and overly generic.
For each of the use cases/interactors, any database action should be wrapped up in a specific interface for that database action. Then implement those database interaction by implementing that interface. Query and command objects instead of repos.
Much finer grained then repos. Also allows for finer grained control over which data source you use for each interaction.
- HelloNurse 7y agoIt depends. Sometimes a repository can cover all needs with relatively few and relatively generic methods, sometimes specialized database interactions can be application logic layered on top of a much less specialized repository, sometimes a repository becomes unpleasant because it should be split up, etc.