On 10/4/12 8:26 AM, "David Richardson" 
<daviric...@yahoo.com<mailto:daviric...@yahoo.com>> wrote:

Yes, I've read about it. I try to implemented it but it did not seem to work. I 
even read somewhere that you can add this to the connectionstring but no luck 
with them.

I tried all these solutions:
http://stackoverflow.com/questions/2477872/problem-with-cascade-delete-using-entity-framework-and-system-data-sqlite
http://stackoverflow.com/questions/7674318/cascade-on-delete-not-cascading-with-ef
http://stackoverflow.com/questions/4981353/how-to-enable-foreign-key-cascade-delete-by-default-in-sqlite

But none of these worked. Either I'm implementing it wrong or there is a bug. 
So i was expecting an out-of-the-box solution to this issue. So do you have an 
working example on how to do this the right way?

I just eval "PRAGMA foreign_keys = ON" as soon as I open the connection, and 
the cascading deletes in the schema all take place as expected.

However, I'm not using Entity Framework 4 or anything like it; there's 
evidently something else going on.

Will

________________________________
From: "Duquette, William H (318K)" 
<william.h.duque...@jpl.nasa.gov<mailto:william.h.duque...@jpl.nasa.gov>>
To: David Richardson <daviric...@yahoo.com<mailto:daviric...@yahoo.com>>; 
General Discussion of SQLite Database 
<sqlite-users@sqlite.org<mailto:sqlite-users@sqlite.org>>
Sent: Thursday, October 4, 2012 10:39 AM
Subject: Re: [sqlite] Fw: sqlite + EF4 + 'on cascade delete' = not working

On 10/4/12 7:29 AM, "David Richardson" 
<daviric...@yahoo.com<mailto:daviric...@yahoo.com>> wrote:


>I¹m having some sort of
>bug with system.data.sqlite. I¹ve been trying for weeks now!  I¹ve
>installed (System.Data.SQLite 1.0.81.0) and
>i¹m using sqlite in combination with Entity Framework 4. Mostly it does
>what I
>want. The only problem I¹m having is that when I try to delete it should
>cascade , but 'on cascade delete¹ does NOT work. I change
>the connectionstring to SQL Server 2008 instance and entity framework
>works
>perfect! So there is something missing here. Or am I doing something
>wrong?


Have you enabled foreign keys using the "foreign_keys" pragma?  This
currently needs to be done each time you connect to the database.

Will
--
Will Duquette -- 
william.h.duque...@jpl.nasa.gov<mailto:william.h.duque...@jpl.nasa.gov>
Athena Development Lead -- Jet Propulsion Laboratory
"It's amazing what you can do with the right tools."










>
>I cannot find any
>information on the internet on how to do this with system.data.sqlite
>properly.
>
>Is this a bug?
>_______________________________________________
>sqlite-users mailing list
>sqlite-users@sqlite.org<mailto:sqlite-users@sqlite.org>
>http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to