Page 2 of 8
JSON Versioning & Schema Evolution
If you've ever shipped an API and then needed to rename a property two weeks later, you already know the pain: clients don't upgrade all at once.
That means your JSON contract has to evolve without br...
C# Ref Structs & Stack-Only Types
I used to hear “stack-only type” and immediately assume it was some niche trick for people benchmarking everything down to the nanosecond.
Turns out, ref struct and Span<T> are useful way earlier than...
HybridCache in ASP.NET Core
HybridCache in ASP.NET Core
I like caching right up until I have to explain which cache API we should use this time.
IMemoryCache is nice and fast. IDistributedCache is nice and shared. Then you end u...
goto in C#: Almost Always a Mistake
The goto statement in C# is one of those features that makes experienced developers visibly uncomfortable when they see it in a code review. There's a reason for that.
Let's talk about why goto exists...
Getting Started with .NET Aspire Local Dev
Getting Started with .NET Aspire Local Dev
If you’ve ever stitched together 2–5 local services, a database, and a queue just to test one feature, you already know the pain. .NET Aspire makes that setu...
Reusing CancellationTokenSource with TryReset
If you're creating a lot of short-lived operations, repeatedly allocating CancellationTokenSource instances can add avoidable pressure.
In .NET, CancellationTokenSource.TryReset() lets you reuse a sou...
Guard Clauses in C# for Cleaner Methods
Nested if blocks make methods harder to read than they need to be. By the time you reach the main logic, you're scrolling past layers of defensive checks.
Guard clauses flatten that structure and make...
Request Timeout Middleware in ASP.NET Core
Long-running requests are rough on everyone. Users wait, reverse proxies retry, and thread pool pressure quietly ramps up.
ASP.NET Core's request timeout middleware gives you a clear upper bound so sl...
Compiled Queries in EF Core
EF Core already caches query plans internally, so for many apps that's enough. But if you've got very hot paths called constantly, compiled queries can trim extra overhead.
They're especially useful i...
Optimistic Concurrency in EF Core
Most business systems eventually hit a "last write wins" bug. Two users edit the same record, both click save, and the second write silently overwrites the first.
EF Core's optimistic concurrency supp...
API Pagination Patterns in ASP.NET Core
Pagination feels straightforward until an endpoint gets real traffic. Suddenly queries are expensive, clients need stable ordering, and "just use skip/take" starts showing cracks.
Here are the paginat...
Using ProblemDetails in ASP.NET Core APIs
Inconsistent error payloads make APIs harder to consume than they need to be. One endpoint returns { message: "..." }, another returns { error: "..." }, and validation failures have a completely diffe...
Endpoint Filters in ASP.NET Core
Minimal APIs are great right up until each endpoint starts repeating the same guard code. Validate input, check headers, enforce tenant context, shape errors — and suddenly every handler has the same ...
FrozenDictionary in .NET 8
Most of the time a Dictionary<TKey, TValue> does the job just fine. But if you've got a lookup table that's built once at startup and then read thousands of times a second, you're paying overhead for ...
EF Core Interceptors for Cross-Cutting Rules
Every team seems to eventually accumulate a little pile of EF Core code that isn't really domain logic, but still has to happen somewhere. Audit timestamps. Soft delete tweaks. Query logging. Maybe a ...