In June I wrote The Interval Is the Thing , about modelling a period as one value instead of two columns. CodoMetis.ValueRanges was at 3.0 then, with six range types. Today it's 10.4, on .NET 10 LTS, and it does a lot more. It has value sets, a NodaTime package, TimeRange , float ranges, and range operations that run in PostgreSQL and agree with the in-memory answer.
This post doesn't repeat the basics (the five shapes, the factories, the set operators). It builds one small thing end to end: a holiday-cottage booking API. It starts with the domain model, goes through a query, and ends with the question June's example only half answered: which nights are still free?
dotnet add package CodoMetis.ValueRanges.EFCore.PostgreSQL
Enter fullscreen mode
Exit fullscreen mode
The model: immutable values, guarded entities
A DateRange and a StringSet are immutable values. Nothing can change one after it's made, and two with the same contents are equal.…