locked
Unique-Constraint Violation during Sync RRS feed

  • Question

  • Hi,

     

    I have some tables with Unique-Constraints and only a subset of the data is offline available. So it is possible to insert new data offline while not violating the Unique-Constraint. However during Synchronization another data record with the same value is online available, so synchronization violates the Unique-Constraint.

     

    Is there any way to detect the Unique-Constraint violation during synchronization and to provide solutions?

     

    My problem is, that I don't want the same solution for all problems. In some cases I have to ask the user what to do, in other cases I can provide an automated solution. If for example two documents have the same name, I can rename one with _Version2.

     

    When being online, I could tell my user that he could not save the new record because he violates a unique-constraint. However, when being offline he can insert the data record and save additional data, so in some cases I have to reassign the additional data during synchronization and remove the base record which conflicts with the Unique-Constraint.

     

    Thanks for your help,

    Christine

    • Moved by Tina_Tian Friday, April 22, 2011 7:52 AM (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Monday, November 17, 2008 7:13 AM

All replies

  • Is the unique constaint the primary key or on some other column?

     

    For primary keys, this would cause an insert/insert conflict.

     

    For other colums, there is no built-in support for detecting and handling.

     

     

    Tuesday, November 18, 2008 10:39 PM
  •  

    Hi,

     

    no it is not for primary keys but for other columns with a unique constraint. E.g. Oracle Database replication for example treats a unique-constraint violation as a conflict of the type Uniqueness.

     

    Is it possible to handle Unique-Constraint Violations in the SyncServices automatically as conflict? Or can I implement strategies by myself?

    Wednesday, November 19, 2008 6:39 AM