The Need for Local Data Handling

The first essential architectural concept, and the one addressed in this chapter, is the need to manipulate data directly on the device. This concept is fundamental because although smart device applications often retrieve and update data using a variety of remote mechanisms, including XML Web Services, HTTP, Microsoft SQL Server, IrDA, and direct socket-based communication, as discussed in the next chapter, those applications also typically require three key services:

  1. Programmatic access: Smart device applications need to be able to work programmatically with data in several ways using a simple and consistent set of APIs. Fortunately, the Compact Framework includes subsets of the System.Xml, System.Data, and System.IO namespaces that allow developers to leverage their knowledge of the desktop Framework and access a robust set of functionalities for manipulating XML, relational, and file-based data directly on the device.

  2. Persistence: Because many smart device applications will be used in a disconnected or occasionally connected mode, as discussed in Chapter 1, it is important to be able to persist the data locally on the device so that it can be reloaded if the application is closed. Once again, the namespaces of the Compact Framework provide simple mechanisms to store and retrieve XML, relational, and file-based data on the device.[1]

    [1] More sophisticated persistance using SQLCE 2.0 will be discussed in Chapter 5. This chapter will not discuss synchronizing data with back-end data stores, which will be handled in Chapters 6 and 7.

  3. UI support: Once the data is retrieved, it is usually displayed to the user in a form for viewing or editing. Fortunately, SDP includes a fairly complete set of controls, as discussed in Chapter 2. Some of these controls can even be used to bind data directly, thereby decreasing the need to write code.

The remainder of this chapter will discuss the three parts of the Compact Framework that allow developers to work with file-based, XML, and relational data locally on the device in the context of the first two services discussed earlier (programmatic access and persistence). The final section will detail how data can be displayed on the devices.