SyncDirection Enumeration

Synchronization Services - ADO.NET 1.0 SP1

Defines the direction that data changes flow, from the perspective of the client.

Namespace: Microsoft.Synchronization.Data
Assembly: Microsoft.Synchronization.Data (in microsoft.synchronization.data.dll)

public enum SyncDirection
public enum SyncDirection
public enum SyncDirection

 Member nameDescription
BidirectionalDuring the first synchronization, the client typically downloads schema and an initial data set from the server. On subsequent synchronizations, the client uploads changes to the server and then downloads changes from the server. 
DownloadOnlyDuring the first synchronization, the client typically downloads schema and an initial data set from the server. On subsequent synchronizations, the client downloads changes from the server. 
SnapshotThe client downloads a set of data from the server. The data is completely refreshed during each synchronization. 
UploadOnlyDuring the first synchronization, the client typically downloads schema from the server. On subsequent synchronizations, the client uploads changes to the server. 

Synchronization direction determines how changes are exchanged between a client and server database during synchronization. For more information, see How to: Specify Snapshot, Download, Upload, and Bidirectional Synchronization.

The following code example is from a class that derives from SyncAgent. The code creates two synchronization groups and three synchronization tables. The Customer table is added to the Customer group and the OrderHeader and OrderDetail tables are added to the Order group. All tables are download-only. If a table exists at the client, the table is dropped and re-created during the initial synchronization. To view this code in the context of a complete example, see How to: Filter Rows and Columns.

//Create two SyncGroups so that changes to OrderHeader
//and OrderDetail are made in one transaction. Depending on
//application requirements, you might include Customer
//in the same group.
SyncGroup customerSyncGroup = new SyncGroup("Customer");
SyncGroup orderSyncGroup = new SyncGroup("Order");

//Add each table: specify a synchronization direction of
//DownloadOnly.
SyncTable customerSyncTable = new SyncTable("Customer");
customerSyncTable.CreationOption = TableCreationOption.DropExistingOrCreateNewTable;
customerSyncTable.SyncDirection = SyncDirection.DownloadOnly;
customerSyncTable.SyncGroup = customerSyncGroup;
this.Configuration.SyncTables.Add(customerSyncTable);

SyncTable orderHeaderSyncTable = new SyncTable("OrderHeader");
orderHeaderSyncTable.CreationOption = TableCreationOption.DropExistingOrCreateNewTable;
orderHeaderSyncTable.SyncDirection = SyncDirection.DownloadOnly;
orderHeaderSyncTable.SyncGroup = orderSyncGroup;
this.Configuration.SyncTables.Add(orderHeaderSyncTable);           

SyncTable orderDetailSyncTable = new SyncTable("OrderDetail");
orderDetailSyncTable.CreationOption = TableCreationOption.DropExistingOrCreateNewTable;
orderDetailSyncTable.SyncDirection = SyncDirection.DownloadOnly;
orderDetailSyncTable.SyncGroup = orderSyncGroup;
this.Configuration.SyncTables.Add(orderDetailSyncTable);

Show: