Hi all, I had a discussion the other day with an experienced developer who told me that "instead of using the repository pattern, they just use CQRS these days."
I am somewhat puzzled with that statement, because it is my understanding that the two are almost completely independent of each other. In simple terms, CQRS is used to separate requests from responses, so data received from a database use different classes from the ones used to submit updates. e.g. PersonCreateInputDto, which might contain just the fields used to create a new person in the database, and PersonOutputDto, which might contain just the fields needed to display a list of Person records. You don't use the same object for both types of transaction, just the bare minimum in each. Repository, on the other hand, is used for dependency injection. By changing the dependency provider, I can switch a set of runtime classes with a set of testing classes. The dependency provider injects the dependent objects that are desired at the time, which could be either runtime objects, or mock testing objects, so it is predominantly used to enable better testing. I got the impression that the person was somehow using CQSR to perform their testing instead. Is there something that I'm missing here? Regards, Tony