Designing for Nullability in C#

Nullable Reference Types (NRT) are enabled by default in .NET 6 templates. It’s time to stop fighting the warnings and embrace the design philosophy. The Golden Rule “Design your types to be initialized fully on construction.” Most NRT warnings come from models that are partially initialized or set via property injection later. If a property […]

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

Choosing the right lifetime for your services is critical for app correctness and memory usage. Transient Created every time it is requested. Lightweight, stateless services. Scoped Created once per HTTP request. Ideal for DB contexts, user session data. Don’t inject Scoped into Singleton! Singleton Created once per application lifetime. Examples: Caching services, configuration. MUST be […]

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 โ†’