,

Updating a Database Schema

It is almost inevitable that when updating your app, adding new features and so forth, you will want to make changes to your database schema. Fortunately, local database support on the phone includes the capability to perform additive changes to a database, such as adding tables, columns, indexes, or associations, while preserving the data in the database.

For more complex schema changes, however, such as dropping a column from a table, you need to create a new database and migrate the data to the new schema.


Note

Changes to your local database schema begin with changing the object model of the corresponding data context. Therefore, modify your entity classes first to reflect the desired state of the schema.


The Microsoft.Phone.Data.Linq.DatabaseSchemaUpdater class provides four schema altering methods:

Image AddColumn<T>(string columnPropertyName)

Image AddTable<T>()

Image AddIndex<T>(string indexName)

Image AddAssociation<T>(string associationPropertyName)

The following sections discuss each of these methods in greater detail.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.166.151