DapperLib / DapperLib/Dapper

Rainbow table doesn't support IDs of type long

Open
#1,777 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
18.4k
Forks
3.7k
Avg merge
5h 8m
Merged PRs (30d)
1

Description

We have a legacy db with very long Ids. Example: 301000000003

So the POCO looks like this:

public class User
{
    public long Id { get; set; }
    // ...
}

And the database class like this:

public class LegacyDatabase : Database<LegacyDatabase>
{
    public Table<User, long> Users { get; set; }
    // ...
}

When calling InsertAsync however there is an exception thrown.
This is because of the fixed return type of int? for InsertAsync. See: Database.Async.cs#L19

Is this by design? Shouldn't the generic type TId be used here?

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.

Research direction

Start in Dapper.Rainbow/Database.Async.cs at line 19 and compare the InsertAsync signature with the Table<User, long> usage described in the issue. Reproduce the long-ID InsertAsync case, inspect related Rainbow APIs and tests, and consider the work complete when insertion succeeds and the returned ID supports the declared TId type.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend, database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.