locked
Specify PK at runtime RRS feed

  • Question

  •  

    I have a couple tables which are using autoint primary keys as part of the general database schema.  These tables need synched to the client however, so I added a GUID column.  The GUID is not specified in the server DB as PK... only the int column is the PK.  I would like to leverage the GUID simply for identifying rows to the synch framework.  Unfortunately, the synch framework refuses to identify the GUID as the PK, and I can't find any functionality to do it.

     

    I would like to use the clientsynchprovider flag to build and update my table schema... I have over 100 tables to synch and this is a huge timesaver.  Most of the tables I am synching do not have this problem, they are download only and the int PKs will work just fine.

     

    I found a work around to the GUID issue, it is not pretty though.  I turned the provider flag off, and wrote my own sql to build the tables so I could specify the PKs.  Is there any way to leave the option on to build the client tables and then build only a couple manually?  Looking at the tablecreationoption enum... I see no option which does not try and throw errors if the table can not be created.  Conversely, I would like to be able to manually specify the PK on these tables.  I tried to use the CreatingSchema event to do this, but it fires after the exception has already been thrown that the table has no PK... which is odd.  I must not understand what this event is for?

    • Moved by Max Wang_1983 Friday, April 22, 2011 7:10 PM forum consolidation (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Friday, June 27, 2008 1:11 PM

Answers

  • Figured this out.  Ran the script at startup and specified tablecreationoption of UseExistingTableOfFail on those tables I ran script for.

     

     

     

    Friday, June 27, 2008 1:41 PM