Chapter 7. Storing data

 

This chapter covers

  • Working with application settings
  • Saving files in local storage
  • Database operations
  • Upgrading databases

Most applications require some form of data storage—from user preferences and user-created data to local caches of data stored in a cloud application or web service. Some of the data storage concepts discussed in this chapter will be familiar to .NET Framework developers because they’re limited versions of the same storage technologies that have existed in the .NET Framework for many years. Other concepts are new to the Windows Runtime, and this may be your introduction to them. In this chapter you’ll learn about the differences between the storage APIs in the .NET Framework and the storage APIs provided in the Window Phone SDK. For starters, the Windows Phone security model limits storage available to third-party applications to the local storage sandbox.

Each application is allotted its own sandbox on the phone, isolated from all other applications and from the operating system. The application’s sandbox is separated into two folders, as shown in figure 7.1. The first folder, often referred to as appdata or the install folder, contains the installed application files. The second folder, called the local folder, IsolatedStorage, or isostore, stores files created or downloaded by the application.

Figure 7.1. Application file system overview

7.1. Creating the High Scores sample application

7.2. Storing data with application settings

7.3. Serializing data to local storage files

7.4. Working with a database

7.5. Summary