SQLiteDataStore Usage Help

Sep 6, 2016 at 11:33 PM
I have an app that's targeting Windows CE 7 and I'm wondering what is the best way to access the SQLiteDataStore object. I'll be querying and updating the database on the UI thread but I'll also have at least one background thread that will be querying and updating the database. Should I share one instance of the SQLiteDataStore object for the UI thread access and also instantiate an instance for each background thread that will be accessing the database? Also, how does the ConnectionBehavior property play into this?

Sep 6, 2016 at 11:39 PM
As a starting point, I'd create a single instance of the SQLiteDataStore for the entire app. Typically I'll put it into a DI container (like the one provided in OpenNETCF IoC) and just pull it from there whenever it's needed anywhere in the app. I don't think I've actually ever tested multiple instances to the same store in one app, so I don't know how it would behave.

Leave the ConnectionBehavior as-is to start with. Only look at modifying it if you have an issue - by default it should perform the best for most applications.
Sep 7, 2016 at 12:31 AM
Ok. Thanks for the quick response. I'll take the approach you recommended and do some testing.

I was also doing some reading on your IoC framework. It looks like Services is what I would use for the singleton instance of the DataStore.