Sébastien Rigaux

Tech watch

← All links

.NET

Microsoft’s development platform: runtime, libraries, SDK and cross-platform applications.

A cube-shaped logo made of gray blocks, with an orange block in the center.

Finbuckle.MultiTenant provides ASP.NET Core with tenant resolution, per-tenant configuration, and data-isolation building blocks. A basic setup combines a host-based strategy, a configuration-backed store, and the UseMultiTenant() middleware.

The middleware must run before components that depend on the tenant, such as authentication and authorization. The library also includes integrations for per-tenant options, authentication, and Entity Framework Core data isolation.

Banner reading “Multi-Tenant .NET, Part 4: Moving Day,” with moving boxes, a guild emblem, and an illustrated portrait.

This installment explains how to move a tenant from a shared database to a dedicated one without taking the application offline or disrupting other tenants. The catalog drives the switch, while the same EF Core model and query filter serve both isolation modes.

The migration uses an initial copy, a temporary read-only window, a delta copy, and verification before cutover. The runbook waits for the cache to expire before reopening writes, preventing instances that still hold the old connection from writing to the shared database after the switch.

BarretFound via C# Digest

A hand handles colorful network cables in front of rack-mounted equipment.

With one database per tenant, EF Core no longer needs a global query filter, a TenantId column, or a tenant-specific model cache key: the tenant is selected through a connection string resolved from a catalog database.

This isolation simplifies the model but shifts complexity to operations: each migration must be applied to every database. The article also explains how IDesignTimeDbContextFactory lets dotnet ef create the context without an active request or tenant.

BarretFound via C# Digest

Graphic titled “Multi-Tenant .NET, Part 2 — Shared Database with Schema Separation,” showing a “House for Rent” sign, a circular emblem with two swords, and an illustrated portrait.

Part 2/4 shows how to isolate each tenant’s data in its own SQL Server schema, without a global query filter or a required TenantId column. EF Core can use a simple primary key again, while the database structure itself enforces the isolation boundary.

The key change is model caching: OnModelCreating runs only once per model. The schema must be included in the cache key through IModelCacheKeyFactory, or EF Core may reuse the first tenant’s schema. The article also covers per-schema provisioning and migrations, plus strict validation of schema names interpolated into SQL.

BarretFound via C# Digest

Banner over a photograph of apartment buildings, titled “Multi-Tenant .NET, Part 1 — Shared Database with Partitions,” with a crossed-swords emblem and an illustrated portrait.

This first installment presents a shared-schema .NET multi-tenant design: EF Core filters reads by tenant, while SQL Server physically partitions rows to speed up data access. The key distinction is that partitioning is not a security boundary; isolation relies on the EF Core global query filter.

The article also explains resolving the tenant per request, assigning its ID to new rows, and adding partitions to migrations with raw SQL. The primary key must include GuildId, a constraint SQL Server imposes when partitioning a unique index.

BarretFound via C# Digest

C# code showing Windows, Linux and MacOS records, followed by a SupportedOS union containing those three types.

C# 15 introduces the union keyword to represent a value drawn from several types without forcing them into a base class or losing their type information in object. Andrew Lock shows how switch expressions enforce handling every case, and how to declare unions such as Result<T>.

One performance detail to weigh: the generated implementation stores the value in an object, boxing value types. The article demonstrates a custom implementation using TryGetValue to avoid boxing in switch expressions.

Andrew LockFound via C# Digest

Yellow “Buy me a coffee” graphic with a stylized cup.

IfItQuacks lets C# code accept objects that match an interface without implementing it or sharing a base class. The [DuckTyped] attribute invokes a source generator that checks compatibility at compile time and creates an adapter—without reflection or dynamic.

Anonymous types can also act as test stubs: an object such as { Name = "Steven", Age = 90 } can satisfy an IPerson interface. Adapters also preserve identity by forwarding Equals, GetHashCode, and ToString to the wrapped instance.

Steven GieselFound via C# Digest

Article banner showing its title, Ricardo Groß’s name, and the date “Jun 11” on a white background.

CodoMetis.ValueRanges offers .NET range types to replace pairs of dates and their scattered logic. Its five variants—finite, unbounded on either side, infinite, and empty—make possible shapes and rules explicit, while operations such as Contains and Overlaps run in memory.

The companion EF Core package bridges the domain model to PostgreSQL: the same operations are translated into SQL operators through Npgsql. The article also explains the design trade-off: abstract records rather than structs, so each variant can be represented by a type hierarchy.

@Found via C# Digest

Metalama automates cross-cutting C# patterns with aspects that generate code at compile time, while checking architecture rules as you edit. The repetitive implementation stays out of business code and the repository, and one aspect can be applied to a method or to a set of methods selected in code.

For example, an aspect can wrap a method in try/catch to log its entry, result, and exceptions. Metalama also lets you preview and debug the transformed code, making those changes inspectable.

Found via C# Digest

dotnetup toolchain manager presentation on the official .NET Blog

Microsoft introduces dotnetup, a toolchain manager for .NET inspired by rustup and nvm, designed to simplify installing, updating, and managing multiple SDK and runtime versions without admin rights. The tool operates entirely in the user’s home directory, respects global.json, lets you track version channels or install daily builds, and streamlines cleanup of obsolete versions. It targets CI/CD use cases and aims for a unified experience across macOS, Linux, and soon Windows.

Chet Husk

DocumentationFR

Major updates in .NET 11: runtime, libraries and SDK

learn.microsoft.comPermalink
Logo .NET 11

This official Microsoft Learn page provides a comprehensive overview of what’s new in .NET 11, currently in release candidate. It details changes in the runtime (performance, native Async, JIT, WebAssembly), libraries (numeric APIs, compression, System.Text.Json, security, LINQ, etc.), SDK (CLI tools, testing, containers, OpenTelemetry), and C# 15 language features. Developers will find a summary of the main improvements, links to updates for ASP.NET Core, EF Core, Windows Forms and WPF, as well as key release dates. Ideal for planning migrations or exploring the new capabilities of the .NET platform.

gewarren