Sébastien Rigaux

.NET range types as first-class domain objects

View resource

dev.to

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.

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