OpenTelemetry (OTel) is the merger of OpenTracing and OpenCensus. In 2020, it is becoming the CNCF standard for collecting metrics and traces. This guide shows how to instrument a .NET Core app to send traces to Jaeger. Setup Manual Instrumentation Key Takeaways Vendor-neutral instrumentation prevents lock-in. “Activity” in .NET 5+ is the native implementation of […]
Read more โCategory: Software/System Design
Clean Architecture in .NET: Practical Implementation
Clean Architecture keeps your business logic independent of frameworks and databases. Here’s how I implement it in .NET projects. The Layers Domain: Entities, value objects, domain events Application: Use cases, interfaces, DTOs Infrastructure: Database, external services WebAPI: Controllers, middleware Project Structure Dependency Rule Dependencies point inward. Domain has no dependencies. Application depends on Domain. Infrastructure […]
Read more โMediator Pattern in C#: Implementing with MediatR
MediatR implements the mediator pattern in .NET, decoupling request handling from the caller. It’s become my go-to for organizing application logic. Setup Request and Handler Using in Controller Benefits Decoupled handlers – easy to test Pipeline behaviors for cross-cutting concerns Clean controller actions References MediatR GitHub
Read more โOutbox Pattern: Reliable Messaging in Distributed Systems
The Outbox Pattern solves a common problem: how do you update a database AND publish a message reliably? Without it, you risk losing messages or creating duplicates. The Problem If the publish fails, your database has the order but no event was sent. Downstream systems never know about it. The Solution Write events to an […]
Read more โEvent Sourcing Fundamentals: Storing Events Instead of State
Event Sourcing flips traditional database design on its head. Instead of storing current state, you store the events that led to that state. It’s not for every project, but when it fits, it’s powerful. The Concept In a typical system, you update records in place. An order goes from “pending” to “shipped” by updating a […]
Read more โRepository Pattern in .NET Core: Implementation Guide
The Repository pattern is one of those patterns that generates debate. Some say it’s essential, others call it unnecessary abstraction over EF Core. Here’s my pragmatic take on when and how to use it. What is the Repository Pattern? A repository abstracts data access, providing a collection-like interface to your domain objects. Instead of calling […]
Read more โ