Skip to content

One-sided ranges#201

Merged
roji merged 2 commits intoefcore:mainfrom
dsdante:main
Dec 16, 2025
Merged

One-sided ranges#201
roji merged 2 commits intoefcore:mainfrom
dsdante:main

Conversation

@dsdante
Copy link
Contributor

@dsdante dsdante commented Dec 14, 2025

closes #199

@dsdante dsdante changed the title One-sided ranges (#199) One-sided ranges Dec 14, 2025
Copy link
Member

@roji roji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks good - see one minor coding style comment, I'll merge once that's done.

sql.Clear();

if (attribute is { MinimumIsExclusive: false, MaximumIsExclusive: false })
if (!attribute.MinimumIsExclusive && attribute.Minimum.Equals(int.MinValue))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this can all be a single switch exception using c# pattern matching:

switch (attribute)
{
    case { MinimumIsExclusive: false, Minimum: int.MinValue } when attribute.Minimum.Equals(attribute.Maximum):
    ...
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Also removed the degeneracy check - for simplicity, and because I don't think anyone in their right mind would write [Range(int.MinValue, int.MaxValue)].

Copy link
Member

@roji roji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good!

@roji roji merged commit 7d84dc2 into efcore:main Dec 16, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement one-sided ranges

2 participants