Answered Using Unique Key...

  • 19 października 2010 14:04
     
     

    Does sync framework require at least one primary to be defined in the server provisioning configuration file? The following segment throws an exception stating that primary key is not defined.

    <SyncTable Name="TaxFiling" GlobalName="TaxFiling" IncludeAllColumns="false">

     <SyncColumns>

    <SyncColumn Name="customerId" IsPrimaryKey="false" SqlType="int" /> //Foreign Key

    <SyncColumn Name="customerTaxFilingId" IsPrimaryKey="false" SqlType="int" /> // Unique Key       

    </SyncColumns>                       

    </SyncTable>

    Our table has an identity column as primary key, and unique key columns as alternate keys. We do not want to configure the identity column to be synced as we do not want the clients to supply the value. In the above configuration, the customerID is a foreign key, and customerTaxFilingId is the unique key. The primary key for this table is an identity column and not configured to be synced. When I ran the provisioning command, it throws an exception stated primary key is not defined. Please advice

Wszystkie odpowiedzi

  • 19 października 2010 16:47
    Moderator
     
     Odpowiedz

    Yes the underlying Sync 2.1 Sql provider does need a primary key for every table. We use that to compute the SyncId for any given row. The requirement is that it must be unique across the table. So if you set ISPrimaryKey="true" for the CustomerTaxFilingId then that should be enough for the providers to provision the tables.


    Maheshwar Jayaraman - http://blogs.msdn.com/mahjayar
    • Oznaczony jako odpowiedź przez arasheed 20 października 2010 12:38
    •  
  • 20 października 2010 12:38
     
     
    Thank you very much!