locked
Synchronization, Handle Schema Changes RRS feed

  • Question

  • I'm using CE 3.5 in a Windows form application. My ServerSyncProvider includes a list of columns, to use on the client, for each table.

    To add a column, I first add the column on the server and then add the column name to the list for that table in my ServerSyncProvider. The synch fails because, I assume, the column list does not match the client schema. To get around this I've been deleting the client DB and starting with a fresh synch. The problem is I lose data if the client DB has not been sync'd prior to the DB deletion.

    How can I make a schema change, adding a column, on the client while preserving the data?

    I've thought about creating 2 different ServerSyncProviders. I would first sync with the old (saving the data) and then deleting the client db and syncing again with a new ServerSyncProvider (including the new column). I'm hoping there is a more elegant solution

    Thanks!

    • Moved by ErikEJMVP Saturday, April 24, 2010 12:26 PM wrong forum (From:SQL Server Compact)
    Friday, April 23, 2010 4:40 PM

Answers

  • Hi Remout,

    Making column changes to ServerSyncProvider is not enough. You will need to modify SPs/triggers and other places. This is non -recommeded and undocumented way of getting it to work.

    I am afriad, your current solution of syncing old client DB and deleting and syncing again is only reasonable one.  Another addition would be to persist the old ce data and import it into new CE before deleting.

    thanks

    Jandeep


    jandeepc
    Thursday, April 29, 2010 11:43 PM

All replies

  • try this, on the client side, listen to the CreatingSchema event, then try adding the column in there.

    Monday, April 26, 2010 2:37 AM
  • Hi Remout,

    Making column changes to ServerSyncProvider is not enough. You will need to modify SPs/triggers and other places. This is non -recommeded and undocumented way of getting it to work.

    I am afriad, your current solution of syncing old client DB and deleting and syncing again is only reasonable one.  Another addition would be to persist the old ce data and import it into new CE before deleting.

    thanks

    Jandeep


    jandeepc
    Thursday, April 29, 2010 11:43 PM