Skip to content

Releases: CaffeinatedCoder/CodoMetis.ValueRanges

v3.0.0

11 Jun 18:34

Choose a tag to compare

New Features

Finally: the companion package CodoMetis.ValueRanges.EFCore.PostgreSQL is here! It enables seamless mapping of range types to PostgreSQL range and multirange columns (leveraging NpgsqlRange<T> under the hood). Implemented LINQ-to-SQL query translation for range operations, including Contains, Overlaps, Intersect, Except and Union. Added support for RangeSet translation and query expression rewriting to properly translate from C# operators (&, |, -) to their Postgres-equivalents.

Breaking Changes

State-check methods now require parentheses
IsEmpty, IsFinite, IsInfinity, IsUnboundedStart, and IsUnboundedEnd were extension properties in v2.x. In v3.0.0 they are extension methods — add parentheses at every call site:

// v2.x
if (range.IsEmpty) {}

// v3.0.0
if (range.IsEmpty()) {}

The change is mechanical and the compiler will flag every affected site. The motivation is EF Core compatibility: extension properties cannot appear in LINQ expression trees, preventing SQL translation. As extension methods they are fully translated by the EF Core companion package.

Full Changelog: v2.0.0...v3.0.0

v2.0.0

11 Jun 13:30

Choose a tag to compare

New Features

  • Implemented Parse and ToString methods across range types for interoperability with PostgreSQL range literal syntax.
  • Introduced JSON converters for seamless serialization.

Full Changelog: v1.0.0...v2.0.0

v1.0.0

10 Jun 17:58

Choose a tag to compare

CodoMetis.ValueRanges - initial release.

Fully functional, in-memory range types for .NET 10, covering all six value domains of PostgreSQL's built-in range types: Int32Range, Int64Range, DecimalRange, DateRange, DateTimeRange, and DateTimeOffsetRange.

Core design
Each type is a discriminated union of five sealed variants — Finite, UnboundedStart, UnboundedEnd, EmptyRange, and Infinity — encoding range shape in the static type. Invalid states are unrepresentable by construction; pattern matching is exhaustive with compiler-enforced coverage. Discrete types (int, long, DateOnly) carry step-size awareness for correct adjacency semantics.

Query operations (extension methods on IRange<T>): Contains, IsContainedBy, Overlaps, IsAdjacentTo, IsStrictlyLeftOf, IsStrictlyRightOf, DoesNotExtendRightOf, DoesNotExtendLeftOf.

Set operations (on types implementing IRangeFactory<TRange, T>): Intersect, Union, Except — all shape combinations handled, returning the correctly typed result.

RangeSet<TRange, T> — immutable, always-normalized multirange (counterpart to PostgreSQL 14+ multiranges). Enforces disjoint, sorted, non-adjacent invariant on construction. Supports Contains, Overlaps, Union, Intersect, Except, Complement, operator aliases (|, &, -), structural equality, and IReadOnlyList<TRange>.

No ORM or database driver dependency. MIT license.