Install our extension to search inside any video instantly.

Discriminated Unions Over Union Types: The EF Core Viewpoint

Added:
245 views14likes15:13zoran-horvatOriginal Release: 2026-07-21

EF Core can persist discriminated unions (replacing C# union types) by mapping them to the same table as their containing entity using table-per-hierarchy strategy, eliminating the need for JOINs on read. This is achieved by configuring the discriminated union as a non-nullable entity with a discriminator column, where the containing entity's ID serves as the identity for the union value, allowing EF Core to handle all conversions automatically without manual data model mapping.