SQL CE database and ClickOnce Deployment

May 15th, 2007

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.

Entry Filed under: WB Editor

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Calendar

February 2012
M T W T F S S
« Feb    
 12345
6789101112
13141516171819
20212223242526
272829  

Most Recent Posts


1