Partager via


Working with Table Schemas (Synchronization Services)

This topic describes several ways in which you can work with the table schemas that are created in the client database. For more information, see How to: Initialize the Client Database and Work with Table Schema.

Schema Changes in the Server and Client Databases

Synchronization Services does not automatically propagate schema changes from the server to the client. For information about how to handle schema changes on the server, see Deploying and Versioning Applications (Synchronization Services). The following schema changes are supported in the client database:

  • Drop tables. The behavior during the next synchronization depends on the value that you specified for CreationOption. If you do not want the table on the client at all, remove it from the SyncTableCollection. When you drop a table that has change tracking enabled, you also drop the system table that tracks delete operations for that table. Therefore, any delete operations since the last synchronization are not uploaded to the server.
  • Add new columns.
  • Drop columns for tables that are involved in snapshot synchronization. This change is not supported for other types of synchronization.
  • Add, drop, and rename indexes.
  • Add, drop, and rename primary keys and other constraints.
  • Modify defaults.

All other changes are not supported and can cause synchronization failures.

Schema Differences Between the Server and Client

In some applications, the schema is different at the client and server. The following points summarize the behavior for a table and the ADO.NET dataset that Synchronization Services uses to update that table:

  • If the dataset contains Column1 and Column2, and the table contains Column1, Column2, and Column3: The values in Column1 and Column2 are applied, and Column3 is set to its default value or NULL if the column does not have a default.
  • If the dataset contains Column1, Column2, and Column3, and the table contains Column1 and Column2: The values in Column1 and Column2 are applied, and Column3 is ignored.
  • If the dataset contains Column1, Column2, and Column3, and the table contains Column1 and Column2, and Column4: The values in Column1 and Column2 are applied; Column3 is set to its default value or NULL if the column does not have a default; and Column4 is ignored.

See Also

Concepts

Considerations for Application Design and Deployment (Synchronization Services)