Re: [sqlite] System.Data.SQLite c#/Linq concurrent reads
Thanks for the hint. Using a separate data context for the other thread solves the problem. But it doesn't make the situation much better, because the data context seem to have separate cashes. So it does not help to cash stuff in the background, because it won't be ready for the main thread anyways. But I think I found an answer for my original question. Thanks! On Thu, Jul 7, 2011 at 12:12, Joe Mistachkin wrote: > > I do not see anything obviously wrong with using the same connection > to construct two or more LINQ data contexts; however, my knowledge of > LINQ and its use of threads is somewhat limited. > > -- > Joe Mistachkin > > ___ > 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] System.Data.SQLite c#/Linq concurrent reads
I do not see anything obviously wrong with using the same connection to construct two or more LINQ data contexts; however, my knowledge of LINQ and its use of threads is somewhat limited. -- Joe Mistachkin ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] System.Data.SQLite c#/Linq concurrent reads
I probably am using a single SQLiteDataReader, although I never explicitly handle one. context = new DataContext(_connection); context.GetTable(); I do all queries on such a table object via Linq. Is there a way to control the DataReader involved with such a query? On Thu, Jul 7, 2011 at 11:06, Joe Mistachkin wrote: > > Benjamin Savs wrote: > > If I run Linq-queries from several threads I will get an exception that > states > "*DataReader has been closed*". Is this normal or should there be a way to > issue > concurrent reads? > > > Are you trying to share a single SQLiteDataReader object instance between > threads > or just the underlying database connection? > > The SQLiteDataReader class is not thread-safe and should not be shared > between > threads. > > -- > Joe Mistachkin > > ___ > 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] System.Data.SQLite c#/Linq concurrent reads
Benjamin Savs wrote: If I run Linq-queries from several threads I will get an exception that states "*DataReader has been closed*". Is this normal or should there be a way to issue concurrent reads? Are you trying to share a single SQLiteDataReader object instance between threads or just the underlying database connection? The SQLiteDataReader class is not thread-safe and should not be shared between threads. -- Joe Mistachkin ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] System.Data.SQLite c#/Linq concurrent reads
Hello everybody, I stumbled upon this mailing list via http://system.data.sqlite.org/ and hope it is the right place to ask. I'm doing queries with c# and linq using System.Data.SQLite and noticed that it doesn't seem to be possible to do concurrent reads on the data. If I run Linq-queries from several threads I will get an exception that states "*DataReader has been closed*". Is this normal or should there be a way to issue concurrent reads? Regards, benjamin ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users