Accessing DB on different background thread - Effiproz locks UI thread

Jan 24, 2011 at 10:52 PM

I'm having problems with loading large datasets (10000+) from Effiproz and binding grids to it. I use Virtualization and asynchonous grid loading, but the problem is that as soon as I access Effiproz the UI thread is locked. The easiest way to see if this is when I have a BusyIndicator which is updating fine for my WCF calls, but as soon as it starts to push the data in Effiproz it locks up and does not update.

I was thinking that I could start a BackgroundWorker thread and do all the database operations in this thread instead - then it would not affect the UI updating (I will show the IsBusy indicator so that the user knows something is happening).

I have not found any discussions or code on accessing Effiproz in another thread -is it a good idea/possible? Advise please...

Jan 24, 2011 at 11:15 PM

You can access EffiProz in a different thread. Make sure that you create a new connection for each thread ( Never share a connection between threads).

Jan 25, 2011 at 5:54 AM

Thanks - I don't suppose you have any examples of code of this? I'm quite new to threading and not sure I am doing it right. I currently use a BackgroundWorker and a global Connection variable.

Jan 25, 2011 at 6:45 AM

Don't use a shared connection. Create per thread connections.