Re: [sqlite] Fw: sqlite + EF4 + 'on cascade delete' = not working

2012-10-13 Thread David Richardson
Ok I found a solution a week ago.  It was really simple to do:

ModelEntities1 ModelData = new ModelEntities1(connString.ConnectionString);
               ModelData.Connection.Open();
                ModelData.ExecuteStoreCommand("PRAGMA foreign_keys = ON");


EF has its own open and close connections mechanism but you can open it 
yourself too. The easiest thing (ofcourse less writing) is the make a static 
class (e.g. Modelconnection) and do something like 'ModelEntities1 ModelData = 
Modelconnection.getConnection())'



 From: David Richardson <daviric...@yahoo.com>
To: "Duquette, William H (318K)" <william.h.duque...@jpl.nasa.gov>; General 
Discussion of SQLite Database <sqlite-users@sqlite.org> 
Sent: Thursday, October 4, 2012 12:21 PM
Subject: Re: [sqlite] Fw: sqlite  + EF4 + 'on cascade delete' = not working
 
Yes, that is the problem: How to do this with entity framework? 

Entity framework does all the class making from the model (ORM). great tool. 
But I find it weird that nobody has stumble upon this problem. I cannot find a 
conclusive answer on this.
you know:
NO(, It is not possible. because[...] . or it will be possible in the next 
build)
YES(, override this and this and there you go)

all the answer are vague on the matter or left alone. So that is why I'm here.




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


On 10/4/12 8:26 AM, "David Richardson" <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>
>To: David Richardson <daviric...@yahoo.com>; General Discussion of SQLite 
>Database <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> 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
>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
>>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
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Fw: sqlite + EF4 + 'on cascade delete' = not working

2012-10-04 Thread David Richardson
Yes, that is the problem: How to do this with entity framework? 

Entity framework does all the class making from the model (ORM). great tool. 
But I find it weird that nobody has stumble upon this problem. I cannot find a 
conclusive answer on this.
you know:
NO(, It is not possible. because[...] . or it will be possible in the next 
build)
YES(, override this and this and there you go)

all the answer are vague on the matter or left alone. So that is why I'm here.




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

On 10/4/12 8:26 AM, "David Richardson" <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>
>To: David Richardson <daviric...@yahoo.com>; General Discussion of SQLite 
>Database <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> 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
>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
>>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


Re: [sqlite] Fw: sqlite + EF4 + 'on cascade delete' = not working

2012-10-04 Thread Duquette, William H (318K)
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


Re: [sqlite] Fw: sqlite + EF4 + 'on cascade delete' = not working

2012-10-04 Thread David Richardson
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?


 From: "Duquette, William H (318K)" <william.h.duque...@jpl.nasa.gov>
To: David Richardson <daviric...@yahoo.com>; General Discussion of SQLite 
Database <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> 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
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
>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


Re: [sqlite] Fw: sqlite + EF4 + 'on cascade delete' = not working

2012-10-04 Thread Duquette, William H (318K)
On 10/4/12 7:29 AM, "David Richardson"  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
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
>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


[sqlite] Fw: sqlite + EF4 + 'on cascade delete' = not working

2012-10-04 Thread David Richardson
Hi all,

I'm not sure if this mail was received by the community (on sunday the 31st of 
semptember 2012). I haven't heard anything yet. So I'm sending it again.

Regards,

David Richardson 

- Forwarded Message -
From: David Richardson 
To: "sqlite-users@sqlite.org"  
Sent: Sunday, September 30, 2012 5:24 PM
Subject: sqlite  + EF4 + 'on cascade delete' = not working
 

Hi community
 
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?
 
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
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users