Skip to content

Can't Use NpgsqlRange in Composite Key #3739

Closed

Description

@TheTedder

I'm experimenting with efcore.pg's new WITHOUT OVERLAPS support but I can't actually get entity framework to create the schema. I've copied the reference documentation exactly and running dotnet ef migrations add MigrationNameHere results in the following error:

Unable to create a 'DbContext' of type 'EmployeeContext'. The exception 'Property 'Employee.ValidPeriod' cannot be used as a key because it has type 'NpgsqlRange' which does not implement 'IComparable', 'IComparable' or 'IStructuralComparable'. Use 'HasConversion' in 'OnModelCreating' to wrap 'NpgsqlRange' with a type that can be compared.' was thrown while attempting to create an instance. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728

My code can be viewed at this repo: https://github.com/TheTedder/npg-temporal-test.

Activity

  1. roji commented on Feb 19, 2026

    @roji
    Member

    Thank you for testing this early in the preview - I clearly didn't do good end-to-end testing on this. I'll take a look ASAP.

  2. self-assigned this
    on Feb 19, 2026
  3. added theissue type on Feb 19, 2026
  4. added a commit that references this issue on Feb 22, 2026
    742a11c
  5. added a commit that references this issue on Feb 25, 2026
    86c777b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions