Nice example, I like how the ICommand and IQuery markers are used just to drive pipeline behavior. Curious if Spyros ran into any friction later when adding more cross cutting concerns.
How I Built a CQRS Approval Flow with MediatR, Carter, FluentValidation, and SQLite
2 Comments
Spyros
•
@[Ben Kiehl]
MediatR uses the same base interface (IRequest) for both commands and queries. At first it looks like it breaks the separation, but in practice it doesn’t violate Single Responsibility, because IRequest is just a transport contract.
In my case, the ICommand and IQuery markers are only there to drive pipeline behavior. For example, in TransactionBehavior I wrap only commands in a transaction, then commit when the command completes successfully. Queries skip that behavior completely.
Please log in to add a comment.
🔥 Join developers growing publicly
Share your knowledge, build in public, and grow your developer presence with a global community.
Please log in to comment on this post.
More Posts
- © 2026 Coder Legion
- Feedback / Bug
- Privacy
- About Us
- Contacts
- You Tube
- Tiktok
- Premium Subscription
- Terms of Service
- Early Builders
chevron_left
54Posts
200Comments
152Connections
Passionate about building robust and scalable software solutions with a focus on .NET technologies. ... Show morePassionate about building robust and scalable software solutions with a focus on .NET technologies. With extensive experience in leading teams, designing systems, and mentoring developers, I strive to deliver high-quality, efficient, and maintainable code. I share insights, tutorials, and best practices to help others grow in their software engineering journey. Always eager to learn, explore, and contribute to the tech community
https://www.linkedin.com/in/spyros-ponaris-913a6937/ Show less
https://www.linkedin.com/in/spyros-ponaris-913a6937/ Show less
More From Spyros
Related Jobs
- Retail Sales Associate Spanish BilingualVerizon · Full time · Germany
- Spanish Bilingual Appointment Setter Work From HomeInsurance Protection Specialists · Full time · Puerto Rico
- Bilingual Retail Sales Associate (Spanish) - VerizonVerizon · Full time · Germany
Commenters (This Week)
raylabs
8 comments
SuMiTa
6 comments
fuxinsuo
1 comment
Contribute meaningful comments to climb the leaderboard and earn badges!