querybuilder icon indicating copy to clipboard operation
querybuilder copied to clipboard

InsertGetId returns 0 on sqlite

Open frenkhub opened this issue 5 years ago • 1 comments

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.

frenkhub avatar May 03 '20 12:05 frenkhub

@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?

ahmad-moussawi avatar Sep 10 '22 16:09 ahmad-moussawi

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

github-actions[bot] avatar Oct 11 '22 00:10 github-actions[bot]