Share via


SyncTable Class

Represents the client settings for a table involved in synchronization.

Inheritance Hierarchy

System.Object
  Microsoft.Synchronization.Data.SyncTable

Namespace:  Microsoft.Synchronization.Data
Assembly:  Microsoft.Synchronization.Data (in Microsoft.Synchronization.Data.dll)

Syntax

'Declaration
<SerializableAttribute> _
Public Class SyncTable
'Usage
Dim instance As SyncTable
[SerializableAttribute]
public class SyncTable
[SerializableAttribute]
public ref class SyncTable
[<SerializableAttribute>]
type SyncTable =  class end
public class SyncTable

The SyncTable type exposes the following members.

Constructors

  Name Description
Public method SyncTable() Initializes a new instance of the SyncTable class by using default values.
Public method SyncTable(String) Initializes a new instance of the SyncTable class by using a table name parameter.

Top

Properties

  Name Description
Public property CreationOption Gets or sets the TableCreationOption enumeration value that represents the action to take when you are creating tables in the client database.
Public property SyncDirection Gets or sets the SyncDirection enumeration value that represents the direction of synchronization from the perspective of the client.
Public property SyncGroup Gets or sets the SyncGroup object that represents the group that this SyncTable belongs to.
Public property TableName Gets or sets the name of the table in the client database.

Top

Methods

  Name Description
Public method Equals Determines whether a SyncTable object is equal to the specified object. (Overrides Object.Equals(Object).)
Protected method Finalize (Inherited from Object.)
Public method GetHashCode Serves as a hash function for a SyncTable. This is suitable for use in hashing algorithms and data structures such as a hash table. (Overrides Object.GetHashCode().)
Public method GetType (Inherited from Object.)
Protected method MemberwiseClone (Inherited from Object.)
Public method ToString Returns a string that represents the SyncTable object. (Overrides Object.ToString().)

Top

Operators

  Name Description
Public operatorStatic member Equality Determines whether the two specified SyncTable objects are equal.
Public operatorStatic member Inequality Determines whether the two specified SyncTable objects are not equal.

Top

Remarks

A synchronization table is defined for each table that is synchronized. It stores settings, such as the direction of synchronization. Each client can request only the tables that it needs. This might not include all the tables that the server synchronization provider makes available. For example, there might be 20 tables, 10 of which are configured for bidirectional synchronization in the Server Synchronization Provider. A client might request only 12 of the tables as download-only. Although the server supports upload, the client does not have to make changes or to synchronize all tables.

Examples

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);
'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.
Dim customerSyncGroup As New SyncGroup("Customer")
Dim orderSyncGroup As New SyncGroup("Order")

'Add each table: specify a synchronization direction of
'DownloadOnly.
Dim customerSyncTable As New SyncTable("Customer")
customerSyncTable.CreationOption = TableCreationOption.DropExistingOrCreateNewTable
customerSyncTable.SyncDirection = SyncDirection.DownloadOnly
customerSyncTable.SyncGroup = customerSyncGroup
Me.Configuration.SyncTables.Add(customerSyncTable)

Dim orderHeaderSyncTable As New SyncTable("OrderHeader")
orderHeaderSyncTable.CreationOption = TableCreationOption.DropExistingOrCreateNewTable
orderHeaderSyncTable.SyncDirection = SyncDirection.DownloadOnly
orderHeaderSyncTable.SyncGroup = orderSyncGroup
Me.Configuration.SyncTables.Add(orderHeaderSyncTable)

Dim orderDetailSyncTable As New SyncTable("OrderDetail")
orderDetailSyncTable.CreationOption = TableCreationOption.DropExistingOrCreateNewTable
orderDetailSyncTable.SyncDirection = SyncDirection.DownloadOnly
orderDetailSyncTable.SyncGroup = orderSyncGroup
Me.Configuration.SyncTables.Add(orderDetailSyncTable)

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.Synchronization.Data Namespace