gRPC-Web: Bringing gRPC to Browser Applications

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 natively alongside standard gRPC. Configuring .NET Server Client Consumption Key Takeaways No need for an external Envoy proxy anymore (though still valid). Performance […]

Read more โ†’

C# 9.0 Init-Only Setters: Immutable Object Initialization

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 setting a property only during object initialization. The ‘init’ Keyword Why this matters for DTOs It allows for consistent, valid state without massive […]

Read more โ†’

C# 9.0 Records: Immutable Data Types Done Right

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, non-destructive mutation, and concise syntax. The Syntax Evolution Value-Based Equality Records check equality by properties, not reference. Non-Destructive Mutation (‘with’ expressions) To modify […]

Read more โ†’

Blazor CSS Isolation: Scoped Styles in .NET 5

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 matching the component name: `Counter.razor.css`. At build time, Blazor rewrites HTML with a unique attribute `b-123abc` and rewrites CSS: The Deep Combinator To […]

Read more โ†’

GraphQL with .NET: Hot Chocolate Library

Hot Chocolate is the premier GraphQL server for .NET. Unlike Rest APIs, GraphQL allows clients to ask for exactly what they need, solving over-fetching. Hot Chocolate 11 brings massive performance improvements and the “Banana Cake Pop” IDE. Schema Definition (Code-First) Handling Relationships (DataLoaders) The “N+1 Problem” is the enemy of GraphQL. Use DataLoaders to batch […]

Read more โ†’

Blazor Component Libraries: Building Reusable UI

Razor Class Libraries (RCLs) allow you to share Blazor components across multiple apps. With .NET Core 3.1 and upcoming .NET 5, they now support including static assets (CSS, JS, images) inside the NuGet package. This guide builds a reusable “Modal” component library. Project Structure Create a new RCL project: Static Web Assets Place CSS in […]

Read more โ†’