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…
All .NET Related Stuffs goes here.
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…
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…
Minimal APIs are great, but how do you test them without a `Startup` class? WebApplicationFactory You must expose the internal `Program` class to your test project. Now you can use `WebApplicationFactory<Program>` in…
.NET MAUI (Multi-platform App UI) is the evolution of Xamarin.Forms. It introduces a single-project structure to target Android, iOS, macOS, and Windows. Single Project Structure No more `App.Android`, `App.iOS` projects. Resources (Images,…
TypeScript 4.3 turns the type system into a programming language itself. Template Literal Types You can now concatenate types! This is incredibly useful for typing strings that follow a specific pattern, like…
.NET 6 introduces “Minimal APIs”, a stripped-down approach to building HTTP APIs without the ceremony of Controllers, Filters, or `Startup.cs`. Four Lines of Code Parameter Binding It infers binding from route, query,…
Don’t implement `RabbitMQ.Client` directly. It’s complex and error-prone. **MassTransit** abstracts the message broker (RabbitMQ, Azure Service Bus, SQS), providing a unified API for consumers, sagas, and fault tolerance. Defining a Consumer Configuration…
Hot Chocolate is the premier GraphQL server for .NET. Version 11 brings “Zero Latency” execution engine improvements. Setup Projection The real power is in [UseProjection]. It translates nested GraphQL queries into optimized…
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……
Vendor lock-in is a real risk in observability. If you instrument your code with `ApplicationInsights.TrackEvent()`, migrating to Datadog or Prometheus later requires a rewrite. OpenTelemetry (OTel) solves this. The OTel Collector Pattern…
Clean Architecture (Robert C. Martin) separates concerns into concentric rings, with the Domain at the center. Dependencies point inward. We implement this in .NET 5. The Layers The Dependency Rule The Application…
Migrating a large enterprise monolith to .NET 5 is different from upgrading a “Hello World” app. We share lessons learned from migrating 50+ microservices, including handling breaking changes in ASP.NET Core and…
With .NET 5 shipped, Microsoft is effectively executing on its annual release cadence. .NET 6 is scheduled for November 2021. Based on GitHub issues and planning docs, here is what we can…
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…
Vue 2’s TypeScript support was… okay, but awkward. It often required class-based components or clunky decorators. Vue 3 was written in TypeScript from the ground up, and the integration is now seamless,…
C# has always been criticized for the “Hello World” ceremony. You needed a namespace, a class, and a static Main method just to print one line. C# 9 Top-Level Programs remove this…
EF Core 5.0 brings the feature everyone has been asking for: Many-to-Many relationships without a mapped join entity. It also introduces Split Queries to fix the “Cartesian Explosion” problem in complex joins.…
Source Generators allow you to inspect code during compilation and generate new C# files on the fly. Unlike Reflection (runtime slow) or IL Weaving (complex), Source Generators are fast, debuggable, and integrated…
.NET 5 is the fastest .NET version ever releases. The engineering team has gone through the runtime and libraries with a fine-toothed comb, optimizing everything from the impacts of the Garbage Collector…
.NET 5 is the first step in the “One .NET” vision, unifying .NET Core and Mono. It drops the “Core” branding but keeps the Core architecture. This guide covers the migration from…
gRPC is great for microservices, but browsers don’t support HTTP/2 trailers required for standard gRPC. **gRPC-Web** is the protocol adaptation that makes it possible. In .NET, we can now host gRPC-Web services…
Before C# 9, to make a property immutable, you had to use constructor injection. This broke object initializers (`new Obj { Prop = val }`). The `init` accessor solves this by allowing…
Immutability is a cornerstone of robust distributed systems, but achieving it in C# has historically required copious boilerplate. C# 9.0 introduces Records, a first-class citizen for immutable data. Records provide value-based equality,…
A preview feature for .NET 5 (arriving Nov 2020) is CSS Isolation. Similar to Vue’s `scoped` styles or React Modules, this prevents style leakage between components. How it Works Create a file…