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 โMonth: March 2021
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 โEvent Sourcing Basics with C#
In traditional databases, we store the current state. In Event Sourcing, we store the sequence of events that led to the current state. Benefits Audit Log: You know exactly what happened and when. Temporal Queries: “What was the balance last Tuesday?” Debugging: Replay events to reproduce bugs. Code Concept
Read more โUnderstanding .NET 5 Top-Level Statements
I’ve been using Top-Level Statements in production worker services for a few months now, and the clarity is refreshing. The compiler generates the class Program { static void Main… } wrapper for you. It reduces noise and makes the entry point script-like, which is perfect for microservices.
Read more โReact Query: Managing Server State in React
Redux is great, but 90% of what we put in Redux is actually server state (API responses) that we are just caching. React Query (now TanStack Query) essentially replaces all that boilerplate. Key Features Auto-caching and invalidation Refetch on window focus Pagination and Request De-duping
Read more โAzure Cosmos DB Free Tier: Getting Started
Cosmos DB now offers a free tier forever: 1000 RU/s and 25GB storage. This makes it viable for side projects and dev/test. Enable it When creating a new account, simply toggle “Apply Free Tier Discount”. You can have one free tier account per subscription. Using the Emulator For local development, don’t forget the Cosmos DB […]
Read more โ