SQLite NOT NULL constraint failed

EF DB first approach. During an insert the exception: "SQLite NOT NULL constraint failed (XX)" occurs. However, no exception will be thrown if I use the SqlClient provider against a MSSQL DB.


  • XY, PK, FK, int not null
  • XX, PK, int not null



        Property(on => on.XX)
        HasKey(on => on.XX);

        Property(on => on.XY)

EDIT: XY is set in the model before .SaveChanges(); XX on the other hand is AI.