O'Reilly logo

Windows® Phone 8 Unleashed by Daniel Vaughan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Schema Versioning

The DatabaseSchemaUpdater class provides a DatabaseSchemaVersion property that allows you to programmatically distinguish between different versions of your database.

When a local database is created with the DataContext.CreateDatabase method, a table named _Version is automatically created. This table holds the current DatabaseSchemaVersion number.

In the following example, the database version is used to determine what needs to be done to update the schema to the current version:

using (TwitterDataContext dataContext                 = twitterDatabaseUtility.CreateContext()){    DatabaseSchemaUpdater updater                 = dataContext.CreateDatabaseSchemaUpdater();    int databaseVersion = updater.DatabaseSchemaVersion; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required