SQLite.Net-PCL icon indicating copy to clipboard operation
SQLite.Net-PCL copied to clipboard

Should the primary key be set to the LastInsertRowId even when the PK column has not been set to AutoIncrement in the DTO?

Open 1Cor125 opened this issue 8 years ago • 0 comments

The SQLite documentation makes it clear that auto-increment is only for the very specific requirement of never reusing a ROWID even if its row has been deleted. We do not have that requirement so we save the extra IO by not including the AUTOINCREMENT directive in our CREATE TABLE statement, using only the PRIMARY KEY directive.

However SQLite.NET PCL does not set the value of the property corresponding to the primary key unless it has been decorated with the AutoIncrementAttribute. Here is the line. Could this be changed to set the property value to the LastInsertRowId as long as the PrimaryKeyAttribute is found?

1Cor125 avatar Sep 28 '16 15:09 1Cor125