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
- Premium Subscription
- Terms of Service
- Refund
- Early Builders
chevron_left
45Posts
167Comments
106Connections
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
- Front-End Developer (Webflow Support)Save the Water · Full time · Fort Lauderdale, FL
- Airflow DevOps EngineerDiamondpick · Full time · Reston, VA
- Remote Staff AI Workflow Architectn8n · Full time · Sweden
Commenters (This Week)
Gavin Cettolo
15 comments
aleklabs.dev
1 comment
automatelab
1 comment
Contribute meaningful comments to climb the leaderboard and earn badges!