locked
SqlSyncAdapterBuilder without PrimaryKey RRS feed

  • Question

  • Hello,

    is it possible to use the SqlSyncAdapterBuilder but define another column as ID?
    I have the problem, that my tables have an INT ID as PrimaryKey and I have to use an UniqueId.
    For this reason I added another column with an UniqueId which is NOT the primary key.

    I also used this column in the Tombstone-Tables. There i defined the UniqueID as primary key.

    When I build my tables with the Builder, e.g.:

                SqlSyncAdapterBuilder builder = new SqlSyncAdapterBuilder((SqlConnection)this.Connection);
    
                builder.SyncDirection = SyncDirection.Bidirectional;
                builder.CreationTrackingColumn = "CREATE_DATE";
                builder.UpdateTrackingColumn = "CHANGE_DATE";
                builder.DeletionTrackingColumn = "DELETE_DATE";
                
    
                // FL_RAUM_T 
                builder.TableName = "FL_RAUM_T";
                
                string[] roomCols = new string[8];
                roomCols[0] = "RAUM_ID";
                roomCols[1] = "RAUM_CODE";
                roomCols[2] = "RAUM_BARCODE";
                roomCols[3] = "CHANGE_DATE";
                roomCols[4] = "USER_NAME";
                roomCols[5] = "COMPUTER_NAME";
                roomCols[6] = "CHANGE_FROM";
                roomCols[7] = "CREATE_DATE";
    
                builder.DataColumns.AddRange(roomCols);
    
                builder.TombstoneTableName = GetSyncTableName(builder.TableName);
    I always get an Exception because the PrimaryKey in the Tombstone Table is not the same like in the original Table.

    How can I prevent this? Is it possible to define another Column (my unique id column) as Sync-ID?


    Regards,

    Martin
    • Moved by Mahesh DudgikarMicrosoft employee Tuesday, May 19, 2009 12:16 AM (From:SyncFx - General)
    • Moved by Hengzhe Li Friday, April 22, 2011 3:15 AM (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Monday, May 18, 2009 9:35 AM