Skip to content

SQLite: Primary key property and value not populated on insert of object with auto-incrementing primary key #323

@jim-wilson-kt

Description

@jim-wilson-kt

I tracked the problem down to the fact that the code doesn't reach the else block in Massive.Shared.PerformInsert, which retrieves the identity value. This is because the _primaryKeyFieldSequence value is an empty string. The source of that value is _defaultSeqencyName in Massive.Sqlite. Setting that value to any non-empty string results in the primary key property being set on the inserted object as expected. From my perspective this is a work-around and probably even a hack, but I don't know what _primaryKeyFieldSequence is supposed to do (despite code comments that explain it). I also don't know if this functionality is covered by unit tests. I'll check when I further investigate the table Schema-property issue I recently posted. I just wanted to post this issue and work-around right away.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions