QUESTION - FOREIGN KEYS
Issue #81
closed
Hello there, im integrating sqlite extensions in a project. I have two questions. When i use the custom attribute [ForeignKey(typeof(Stock))] does this create a SQL CONSTRAINT FOREIGN KEY in the table (eg. FOREIGN KEY(...) REFERENCES Stock(...))?
im using this on an android project and i pulled the database.db file from the simulator and the tables dont have the CONSTRAINT FOREIGN KEY there.
I had another question: To support One to many relations, when it is necessary to use cascade?
Comments (3)
-
-
- changed status to closed
-
Account Deleted reporter thank you. keep up the good job.
- Log in to comment
No, SQLite-Net Extensions doesn't add foreign key constraints to database as SQLite.Net doesn't support it. In fact, you can skip that attribute and declare the foreign keys in the relationship itself, for example:
Cascade operations are just a utility that is provided to make recursive operations easier, by loading or writing all the model tree at once. If you don't plan to use recursive operations, there's no need to use it.