Persisting Data Without a Database

SQL Server CE is a good choice for storing and organizing your data, but it is not the only choice. There are two lighter-weight alternatives you can use:

  • You can create your own DataSet and use its built-in capability to persist itself as an XML file.

  • You can use a custom object and use XML serialization to save its state to a file.

Persisting to a file is often used for simple data records such as the settings for an application.

Serializing DataSet Objects

You can add a DataSet to your project and use the Data Designer to design tables in it, or you can create a DataSet programmatically. Then you store your data in it in the same way you do using a DataSet that you created by dragging tables from a SQL Server CE ...

Get Microsoft® Mobile Development Handbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.