I have a wpf application that saves items in a SQL Server Compact Edition file.
This file is created dynamically from a list of classes that make up the data context.
I’m experiencing slow load times when I have the following scenario.
Trying to load a list of ItemA that contains a List of ItemB
In my datacontext this links to Table1, A Link Table From Table1 To Table2 and Table2
To get this into my application I Load All Table1 rows from Sql Server.
For Each Table1 row returned I add any information to a New ItemA. I then look for any Table2 rows that link to the current Table1 row via the link table. For All Table2 rows returned I convert them to a list of ItemB’s and add them to ItemA.
I eventually end up with a list of ItemA, each object containing a list of ItemB. The problem is I’m making multiple calls to the DB and this is pushing up load times when getting to a few hundred items.
Is there a better way of doing this without the multiple calls?
If not what’s the best way to speed up the app? Should I be Caching ItemA, if so what’s the best way to do this?
Not so much of an answer but I believe that sql ce isn’t fast enough for the scenario raised above. I therefore changed my backing store to an in memory list that is serialized to file as per my comment above.
After a month of testing I haven’t experienced any issues and have dramatically improved the speed of my application.