I have a situation here that I expect will apply to others as Microsoft's "Entity Framework" is used with System.Data.SQLite .

The framework opens and closes the database, presumably like it treats other DB connections. The schema that it sets up for objects related to each other relies on foreign keys. Unfortunately, foreign key enforcement in SQLite, as now specified and implemented, only lasts from the time a PRAGMA is issued to turn it on until the connection is closed. Without some trickery, (or modifying System.Data.SQLite from its distributed form), I see no way to hook DB opens so that I can get foreign key enforcement turned on when it needs to be on.

I recognize that I can compile SQLite myself with foreign key enforcement defaulted to on. I may have to do that, but it would be nicer to be able to use System.Data.SQLite as built and distributed by sqlite.org .

Perhaps it would make sense for foreign key enforcement to be made persistent if something like
  PRAGMA foreign_keys(1, 'PERSISTENT')
was executed. This could work to turn enforcement off, which could be useful once SQLite begins having it on by default.

If anybody knows how to solve this more easily than suggested above, I would appreciate your input.

Thanks,
--
Larry Brasfield
*
*
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to