Page 1 of 1

Using a SQLiteProgressCallbackHander with Linq

Posted: Tue 19 Feb 2013 17:18
by HadleyHope
Really like working with linqConnect so far, but I have a couple of long running queries, is it possible to display a progress bar?

I note that the SQLiteConnection class has a RegisterProgressHandler method, but I am at the moment just using the data context created from the database via the Entity Developer passing in a connection string.


Thanks Martin

Re: Using a SQLiteProgressCallbackHander with Linq

Posted: Thu 21 Feb 2013 13:37
by MariiaI
You could try doing this in the next way - after creating a DataContext object, get its connection, cast it to SQLiteConnection and then use RegisterProgressHandler/UnRegisterProgressHandler methods. For example:

Code: Select all

 MainContext.MainDataContext dt = new MainContext.MainDataContext();           
 SQLiteConnection conn = (SQLiteConnection) dt.Connection;
 conn.Open();
 conn.RegisterProgressHandler(handler);
 ....
 conn.UnRegisterProgressHandler();
Please tell us if this helps.