querybuilder
querybuilder copied to clipboard
InsertGetId returns 0 on sqlite
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 @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?
It looks like there hasn't been a reply in 30 days, so I'm closing this issue.