Archive for May 15th, 2007

SQL CE database and ClickOnce Deployment

My default SQL CE database was deployed to ClickOnce Data Directory. If changed the database schema, ClickOnce will deploy the new database and keep the old database file (in .pre folder). Here is the psuedo code to migrate schema:

if (IsFirstRun)
{
   if (customMigrationORMergeNeeded)
   {
      string dataFolder = call the API
      // Database from V1 of the    app
      string oldDatabase = Path.Combine(dataFolder,”.pre\db1.db”);
      if (File.Exists(oldDatabase))
      {
         string newDatabase = Path.Combine(dataFolder,”db1.db”);
         //perform the task needed with old and new one
         DoPerformCustomMigrationORMergeAsNeeded();
      }
}

What about removed the program from control panel? Data are all gone.

Looks like better to copy database file to the application data folder.

Add comment May 15th, 2007


Calendar

May 2007
M T W T F S S
« Oct   Jun »
 123456
78910111213
14151617181920
21222324252627
28293031  

Posts by Month

Posts by Category


1