Reputation: 388
I created a foreign key constraint ON DELETE SET DEFAULT in the database and I assigned a default value.
What I tried:
What could I have possibly missed...
Update: The App.Config was somehow desynched with the project settings thus the extra parameters were not included in the build. However adding the parameter through the project properties throws an error.
"Data Source=.\InventoryManagerDatabase.db;foreign keys=true;"
Error:
System.InvalidOperationException: 'Unknown connection string parameter 'foreign keys'.'
Apparently this parameter does not exist? I checked various resources including Enabling Foreign key constraints in SQLite & SQLite EF6 programmatically set connection string at runtime but that is weird... Did SQLite remove this parameter or rename it?
I also tried (as well as case-sensitivity combinations):
EnforceFKConstraints=True;
foreign key=true;
foreign keys=true;
foreign_keys=true;
ForeignKeys=true;
Foreign Key Constraints=true;
PRAGMA foreign_keys = ON; // obviously does not work
But nothing works...
Upvotes: 2
Views: 1139
Reputation: 388
Found it, finally!
Solution:
connectionString="Data Source=.\YourDatabaseName.db;Foreign Key Constraints=On;Version=3;"
Yeap they somewhere changed it to Foreign Key Constraints=On and every page on Google including StackOverflow still show the old parameter...
Upvotes: 3