Restoring the Local Database

Restoring the local database involves submitting a background transfer request to download the previously uploaded file from the server. The file is downloaded to a temporary location in isolated storage, the existing local database is disconnected, and its file is replaced.

The RestoreDatabase method begins by creating a temporary directory where the downloaded .sdf file can be placed by the BackgroundTransferService:

const string downloadPath = transferDirectory + "/" + localDatabaseName;using (IsolatedStorageFile isolatedStorageFile            = IsolatedStorageFile.GetUserStoreForApplication()){    if (!isolatedStorageFile.DirectoryExists(transferDirectory))    {        isolatedStorageFile.CreateDirectory(transferDirectory); ...

Get Windows® Phone 8 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.