locked
Server schema changes propagate to client? RRS feed

  • Question

  • SFx 1.0; SqlServer 2008 with CT; n-Tier WCF; PC clients

    I have a solution that been live for 3 months ... now I want to change table schema on the server and clients ... what do i need to know about doing this?  Do i just need to change the schema on the server and change the table adapter to reference the new tables?  Will the sync apply the schema changes?  If I run a routine to apply schema changes to clients (outside a sync) how will change tracking be affected?

    Can I make schema changes on the server tables w/o breaking change tracking (assuming they are fields that I don't care about sending to clients)?

    I am starting a rewrite for SFx 2.1 ... will anything be different in 2.1 for propagating schema changes to clients than your answers to my questions above?

    Friday, May 13, 2011 6:06 PM

Answers

All replies

  • changing schema for the offline provider is easier than the SqlCESyncProvider/SqlSyncProvider.

    for the offline provider, if you havent changed the PKs, you just have to apply the schema changes separately and update the adapter codes to reflect the new schema.

    it gets tricky for the other providers since schema change propagation is not supported either. the suggested approach is to deprovision and reprovision. however that means losing context of what was already synched.

    i wrote a 4-part blog post on possible work arounds for schema changes. you can check it out here: http://jtabadero.wordpress.com

     

     

    • Marked as answer by P H T Friday, May 20, 2011 12:30 PM
    Saturday, May 14, 2011 1:31 AM
  • Using SFx 1.0 (rewriting to SFx 2.1); SQL 2008 (with CT); WCF as n-tier; SqlCe

    Thanks JuneT for the link - good stuff!

    Due to my newness to the 2.0 "scope" concept I don't understand Part 1 of the 4-part post re: modifying scope definitions.  When/how do all these "objects created by Sync Framework" (tracking tables, stored procedures, triggers, etc.) get created?  The designer for 1.0 handled this level of work ... without a designer I don't understand when the objects get created "by Sync Framework".  I think I see how to provision 2.0 as far as the Orchestrator goes ... but what about the Sql Server objects ... when/how are these objects created.

    When you say they are created "during scope provisioning" ... does this mean they are created on the server during the 1st sync and persist (or maybe re-created each sync)?




    Tuesday, May 17, 2011 3:05 PM
  • Provisioning is the part that prepares the database for synchronization. That's when you tell Sync framework what tables and columns to sync. Sync framework then creates the objects to track changes, enumerate the changes and apply the changes.  When you use the Local Database Cache Wizard, that's taken care of by the wizard for you.

    however, SqlSyncProvider/SqlCeSyncProvider has no designer support so you have to do this by code via the API.

    see: http://jtabadero.wordpress.com/2010/09/02/sync-framework-provisioning/

    or http://msdn.microsoft.com/en-us/library/ee617382(v=SQL.110).aspx 

    or http://msdn.microsoft.com/en-us/library/ff928580(v=SQL.110).aspx

     

     

    • Marked as answer by P H T Friday, May 20, 2011 12:30 PM
    Tuesday, May 17, 2011 3:34 PM
  • I have read a lot of stuff (including the first 2 links you sent) about this ... but my understanding of "provisioning" was totally wrong because I could not get 1.0 methodology out of my mind ... thanks!  (because 1.0 was my reference point ... I read the links before with the understanding that "provisioning" was the process of adding tables to a group etc. -- that happens every sync)

    I now understand that provisioning is a one time process (ignoring things like schema changes) that configures the SQL server (in my case) to handle syncing.  Provisioning a client is a one time process that creates a SqlCe (in my case) .sdf file configured for syncing.

    Question ... I have (in my SFx 1.0 application) an n-tier solution with a WCF service as the middle tier ... how will this concept be affected?

    I think I understand that all the SFx 1.0 SyncAdapter SQL statements will have to move into the 2.0's scope definitions on the server ... the service becomes little more than a communication broker between the client and server data stores.

    Tuesday, May 17, 2011 4:59 PM
  • yes, you will have to write a WCF service as well. check out the section Code Specific to N-tier in this link: http://msdn.microsoft.com/en-us/library/dd918908.aspx#Y3096
    • Marked as answer by P H T Friday, May 20, 2011 12:29 PM
    Tuesday, May 17, 2011 11:39 PM
  • Thanks for the direction ... thanks to your help we are making a lot of progress ... but are stuck on understanding how the dll from the web service is being used in the demo.  Any comments on our issue posted here http://social.microsoft.com/Forums/en-US/syncdevdiscussions/thread/0a37f1f0-df10-4c42-8974-13b4cbeec9fc would be very much appreciated!
    Tuesday, May 24, 2011 3:25 PM