title: Thread Safe way to access SQL CE Database
body: <p>Background:</p>
  
  <p>In my windows phone project. I use local SQL CE database to store date. The create the database tables using LINQ to SQL programmatically.</p>
  
  <p>This database is accessed through various datacontext instances in couple of threads.</p>
  
  <p>Here's the issue:</p>
  
  <p>I give an option to the user of my app to erase all the data and logout. When the user selects this, I delete the database using the datacontext's DeleteDatabase method. But, I always receive the error that the database is being used by another process, hence cannot delete.</p>
  
  <p>Any nudges in the right direction will make my day.</p>