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
48Posts
170Comments
117Connections
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
- Software Engineer, Test & Infrastructure II (Bilingual Spanish)Vail Systems · Full time · Springfield, IL
- Senior Software Engineer (Java Full stack , AI, Python, PyTorch , TensorFlow, Hugging Face)Mastercard · Full time · India
- Front-End Developer (Webflow Support)Save the Water · Full time · Fort Lauderdale, FL
Commenters (This Week)
buildbasekit
3 comments
JSON
2 comments
amanwebsolution
1 comment
Contribute meaningful comments to climb the leaderboard and earn badges!