You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Repositories are primarily useful on the write-side of an application. They are meant to handle complex relationships within Aggregates, enclose changes in transactions, and represent domain concepts close to the database layer.
The read-side, in contrast, is simpler, closer to database concepts, and custom-fit for the consumption side of the application (like GET APIs or user interfaces). These queries often change with interface requirements. Mechanisms like Graph APIs and tools like PyPika make it easy to reduce the burden on the app itself and allow consumers to specify what they want to fetch. Maintaining queries on the app itself can be a waste of time with rapid-changing requirements.
Should we distinguish between command repositories and query repositories?
This would allow the read side to be completely distinct from the write side and potentially work with a different set of data structures. If we use the CQRS pattern and split the command and query sides, the read side will work with query models anyway.
Follow-up questions:
What would be the best way to separate the repositories for read and write?
Should repositories be allowed to query databases?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Repositories are primarily useful on the write-side of an application. They are meant to handle complex relationships within Aggregates, enclose changes in transactions, and represent domain concepts close to the database layer.
The read-side, in contrast, is simpler, closer to database concepts, and custom-fit for the consumption side of the application (like GET APIs or user interfaces). These queries often change with interface requirements. Mechanisms like Graph APIs and tools like PyPika make it easy to reduce the burden on the app itself and allow consumers to specify what they want to fetch. Maintaining queries on the app itself can be a waste of time with rapid-changing requirements.
Should we distinguish between command repositories and query repositories?
This would allow the read side to be completely distinct from the write side and potentially work with a different set of data structures. If we use the CQRS pattern and split the command and query sides, the read side will work with query models anyway.
Follow-up questions:
Beta Was this translation helpful? Give feedback.
All reactions