Designing for Nullability in C#

With Nullable Reference Types (NRTs) enabled by default in .NET 6 templates, designing APIs that clearly communicate nullability is no longer optional—it’s expected. Enabling NRTs Guard Clauses Use the new .NET 6 helper to throw if null. Key Takeaways Use `string?` to explicitly mark nullable strings. Use `!` (null-forgiving operator) sparingly—only when you truly know […]

Read more →

.NET 6: Minimal APIs Explained

Minimal APIs are the biggest shift in ASP.NET Core since version 1.0. They remove the MVC ceremony (Controllers, Actions, Filters) in favor of a fluent lambda-based syntax. The Code Is it just for tiny apps? No. Performance is technically better than MVC (fewer allocations, no Filter Pipeline overhead). However, organization becomes the challenge. You don’t […]

Read more →

Dependency Injection in .NET: Service Lifetimes

Using the wrong DI lifetime is the #1 cause of concurrency bugs in ASP.NET Core. We revisit Singleton, Scoped, and Transient with a focus on thread safety. The Three Lifetimes Lifetime Created… Thread Safety Transient Every time requested Safe (Instance per usage) Scoped Once per HTTP Request Safe (Single thread per request) Singleton Once per […]

Read more →

Blazor WebAssembly Authentication with Azure AD

Securing a Single Page Application (SPA) can be tricky. Blazor WebAssembly makes it easier by providing built-in integration with OpenID Connect (OIDC) providers, including Azure Active Directory (AAD). Here is how to secure your app. App Registration First, register your app in the Azure Portal. 1. Create a “Single-page application” registration. 2. Set the Redirect […]

Read more →