A repository serving different consumers can accumulate methods for unrelated needs. Apply the Interface Segregation Principle by splitting it into focused interfaces, so each client depends only on the operations it uses. A single adapter can implement those interfaces. section 5.3.2
Repository contracts can separate writes such as save and delete, aggregate reads used before mutation, and DTO queries used to serve data. Command handlers use the first two; query handlers use DTO queries. section 5.3.2
Table 5.1 Read-side vs. write-side repository method conventions
|
Concern
|
Method prefix
|
Accepts
|
Returns
|
Used by
|
|
Persist state
|
save, delete
|
Domain entity
|
Either<Error, Void>
|
Command handlers
|
|
Load for mutation
|
read
|
Identifier
|
Either<Error, DomainEntity>
|
Command handlers
|
|
Retrieve for display
|
find
|
Identifier or criteria
|
Either<Error, DTO>
or
Either<Error, Collection<DTO>>
|
Query handlers
|
Compare repository method prefixes, inputs, return values, and the handlers that use them. section 5.3.2



