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

Azure Static Web Apps: Now Generally Available

Azure Static Web Apps (SWA) has hit GA. It’s the best way to host Blazor WASM, React, or Vue apps on Azure. Features Global Hosting: Content serves from edge locations. Integrated API: Deploy Azure Functions alongside your frontend in the same repo. Auth: Built-in auth for Azure AD, GitHub, etc. Staging Environments: Every Pull Request […]

Read more โ†’
Posted in UncategorizedTagged

Azure SQL Hyperscale: 100TB Databases

Standard Azure SQL tiers hit a wall at 4TB. Hyperscale changes the architecture fundamentally. Architecture Hyperscale decouples Compute from Storage using a caching tier (RBPEX). This allows it to scale to 100 TB. More importantly, backups are near-instantaneous (file snapshots) regardless of size. If you have a 20TB database, restoring it takes minutes, not days.

Read more โ†’
Posted in Uncategorized

Integration Testing with Testcontainers

“It works on my machine” usually means “I have a local SQL Server running”. This breaks in CI. Testcontainers is the solution. Ephemeral Infrastructure Testcontainers spins up a real Docker container for your test, runs the test, and throws it away. This means you are testing against the exact version of SQL Server (or Redis, […]

Read more โ†’
Posted in Uncategorized

React Query: Server State vs Client State

We used to put everything in Redux. API responses, UI flags, Form state. This was a mistake. The Separation Client State: Ephemeral. “Is the modal open?”. Use `useState`. Server State: Persisted remotely. “List of users”. It is asynchronous and stale by definition. Use React Query. React Query handles caching, background refetching (swr), and retries automatically. […]

Read more โ†’
Posted in UncategorizedTagged

C# 9 Source Generators: Removing Reflection

Reflection is slow. It happens at runtime. Source Generators happen at compile time. This is the biggest performance lever in modern .NET. Case Study: AutoMapper AutoMapper historically used reflection/expression trees to map Object A to Object B. This has startup cost. The new generation of mappers (Mapster, Riok.Mapperly) use Source Generators. The generated code is […]

Read more โ†’
Posted in Uncategorized