OData / OData/AspNetCoreOData

ulong converted to long raises OverflowException

Open
#596 2 comments 0 reactions 1 assignee View on GitHub

@corranrogue9 is already working on this.

Since May 17, 2022.

bug
Dominant language
C#
Stars
505
Forks
186
PR merge metrics
No merged PRs in 30d

Description

Assemblies affected
Microsoft.AspNetCore.OData v.8.0.10
Microsoft.OData.Core v7.11.0

Describe the bug
Instead of representing row version with a byte array, I want to use a ulong (https://docs.microsoft.com/en-us/ef/core/modeling/value-conversions?tabs=data-annotations#use-ulong-for-timestamprowversion).

By default, ulong is converted to long and any value greater than long.MaxValue causes an OverflowException.

Reproduce steps
I've created a repo that contains an example (commented out) and a workaround: https://github.com/andygjp/ODataCustomUnsignedIntVersion/tree/main

Expected behavior
Instead of converting ulong to long, it should use another type, either custom or existing (decimal perhaps), avoiding OverflowExceptions and allowing me to do away with my custom conversion.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.