Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InsertGetId returns 0 on sqlite #368

Closed
frenkhub opened this issue May 3, 2020 · 2 comments
Closed

InsertGetId returns 0 on sqlite #368

frenkhub opened this issue May 3, 2020 · 2 comments

Comments

@frenkhub
Copy link

frenkhub commented May 3, 2020

This is my code:

        public VORace Create(VORace x)
        {
            x.RaceId = null;
            int id = _queryFactory
                .Query("Race")
                .InsertGetId<int>(x);
            x.RaceId = id;
            return x;
        }

this is my model:

    public class VORace
    {
        public int? RaceId { get; set; }
        public string RaceName { get; set; }
        public int MediumWeight { get; set; }
    }

this is my table:

CREATE TABLE Race (
    RaceId       INTEGER       NOT NULL,
    RaceName     NVARCHAR (64),
    MediumWeight INTEGER,
    PRIMARY KEY (
        RaceId
    )
);

The insert operation works and the row id has incremented, but the returned id is always 0. Thank you in advance.

@ahmad-moussawi
Copy link
Contributor

@frenkhub @generik0 I can't reproduce this, and the SQLite execution tests are passing as expected,
I am using the Microsoft.Data.Sqlite package

more details here https://docs.microsoft.com/en-us/dotnet/standard/data/sqlite/?tabs=netcore-cli

Can you confirm please?

@github-actions
Copy link

It looks like there hasn't been a reply in 30 days, so I'm closing this issue.

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

No branches or pull requests

2 participants