Carter in a CQRS API, advantages and alternatives.
In this project I wanted the API layer to stay small and structured. I like minimal APIs, but I don’t like having 200 endpoints inside Program.cs. That’s why I used Carter, it keeps the minimal API...
The tech stack I used and why updated, with Repository and Unit of Work
This project is small, but I wanted it to feel like a real API you can extend. The repository is here:
https://github.com/stevsharp/ChainOfResponsibilityWithMediatR
Carter f...
Chain of Responsibility inside CQRS with MediatR, a small practical example
When we talk about “clean architecture” in ASP.NET Core, it is easy to end up with too many layers and too many rules, and the simple business logic becomes hard to read. T...
Why learning to build your own ORM is worth it even if you use EF Core or Dapper
Most developers meet ORMs the same way they meet electricity, you flip a switch and things work. That’s great, until something gets slow, a query behaves oddly, or you...
1. Introduction
Most .NET apps need some kind of background work. Sending emails, generating reports, cleaning data, all of these are better when they run automatically on a schedule, instead of being triggered by users.
You do not always need a h...
Tutorial: Building a .NET 9 Console App with Hangfire and Channels
Overview
In this tutorial, you will build a .NET 8 console application that:
Polls data from an API, or simulates it
Uses System.Threading.Channels for producer consumer messagi...
Decorator pattern, in short
The decorator pattern is a structural design pattern that lets you add behavior to an object at runtime by wrapping it with another object that has the same interface. The wrapper forwards calls to the inner object, then ...
The problem we’re solving
Stuff goes wrong: timeouts, not-found resources, validation fails. You want one consistent error response and clean logs, without sprinkling try/catch everywhere.
Two good options
Option A — Global Exception Handler recom...
Introduction
Distributed systems are powerful — but they come with one big challenge: reliability.
What happens if your application updates a record in the database and then tries to publish a message to a message broker… but crashes in between?
...
MassTransit in ASP.NET Core: A Practical Guide to Event-Driven .NET
Intro
Event-driven architectures help teams decouple services, scale independently, and handle failures gracefully. MassTransit is a mature, open-source library that makes message-b...
Modern applications often need to broadcast events across multiple services.
Think of an order being placed in an e-commerce system. The order service publishes an event, and multiple subscribers react independently:
1. the billing service charges ...
MassTransit has been around since 2007 and has matured into one of the most stable and feature-rich open-source .NET messaging frameworks.
It acts like a factory for message brokers, meaning you can switch between providers such as RabbitMQ, Azure S...
1. Introduction
When you’re using EF Core in production, query compilation can quietly become a performance bottleneck — especially if the same query is executed thousands of times.
Normally, EF Core parses your LINQ, generates SQL, and prepares ...
In this example, we build a reusable Blazor component using Syncfusion’s SfMultiSelect that supports:
Dynamic option filtering based on a Picklist type e.g., Color, Unit
Two-way data binding with a parent component
Internal state management to avo...
When you’re working with bulk data operations, upserts, or syncing external sources, MERGE is one of the most powerful tools SQL Server offers. But what happens when you need to use it alongside Entity Framework Core?
In this article, we’ll cover:
...
Modern C# development is built on asynchronous code. But even seasoned developers often confuse await with Task.Run. While they both deal with tasks, their purposes are entirely different. Misusing one for the other can lead to performance issues, de...
Is the Repository Pattern Dead?
Introduction
The repository pattern has been a cornerstone of enterprise .NET architecture for years. It promised clean separation between business logic and data access, testability, and maintainability. But with mo...
Why Records in C# Are Great
If you’ve been working with C# lately, you’ve probably encountered records , a feature introduced in C# 9 that many developers have come to love.
They’re elegant, powerful, and remove a lot of boilerplate when modeling...
Exploring Actions, Effects, and the Benefits of Fluxor
Modern web applications are becoming increasingly complex, and with complexity comes the need for structured state management. In the world of Blazor a popular .NET-based web UI framework .
Flu...
Blazor1 is a modern framework from Microsoft that allows you to build interactive web applications using C# and .NET, both on the server and the client, without needing JavaScript. It brings the full power of .NET to the browser via WebAssembly or se...