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

AddColumn

AddColumn allows you to add a new column to an existing table. For example, if you added a new property to the TwitterUser class to record the user’s age, you would then need to use the DatabaseSchemaUpdater to create a new column to store the Age value. This could be achieved in the following manner:

using (DataContext dataContext            = new TwitterDataContext("isostore:Twitter.sdf")){    DatabaseSchemaUpdater updater                  = dataContext.CreateDatabaseSchemaUpdater();    updater.AddColumn<TwitterUser>("Age");    updater.Execute();}

Note

The AddColumn method only allows columns to be added that can contain null values. Therefore, decorating a property with [Column(CanBeNull = false)]

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