# .NET range types as first-class domain objects

Canonical source : [.NET range types as first-class domain objects](<https://sebastien.rigaux.be/en/tech-watch/links/net-range-types-as-first-class-domain-objects>)

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.

- Selected on : 2026-11-01

- Resource publication : 2026-06-11

- Entry updated : 2026-11-07T20:32:37+0000

- Format : Article

- Source language : EN

- Credit : @

- Found via : [C\# Digest](<https://csharpdigest.net/>)

Original resource : [.NET range types as first-class domain objects](<https://dev.to/caffeinatedcoder/the-interval-is-the-thing-modelling-range-types-as-first-class-domain-objects-in-net-3jha>)

Tags : [.NET](<https://sebastien.rigaux.be/en/tech-watch/tags/dotnet>) · [C\#](<https://sebastien.rigaux.be/en/tech-watch/tags/c-sharp>) · [Entity Framework Core](<https://sebastien.rigaux.be/en/tech-watch/tags/entity-framework-core>) · [PostgreSQL](<https://sebastien.rigaux.be/en/tech-watch/tags/postgresql>) · [Software Architecture](<https://sebastien.rigaux.be/en/tech-watch/tags/software-architecture>)

Available versions : [Français](<https://sebastien.rigaux.be/veille/liens/net-modeliser-les-intervalles-comme-objets-metier>) · [English](<https://sebastien.rigaux.be/en/tech-watch/links/net-range-types-as-first-class-domain-objects>)

[Back to tech watch](<https://sebastien.rigaux.be/en/tech-watch>)
