SyncTable 類別
表示與同步處理有關之資料表的用戶端設定。
命名空間: Microsoft.Synchronization.Data
組件: Microsoft.Synchronization.Data (在 Microsoft.Synchronization.Data.dll 中)
語法
'宣告
<SerializableAttribute> _
Public Class SyncTable
'用途
Dim instance As SyncTable
[SerializableAttribute]
public class SyncTable
[SerializableAttribute]
public ref class SyncTable
[<SerializableAttribute>]
type SyncTable = class end
public class SyncTable
備註
同步處理資料表會針對每個進行同步處理的資料表而定義。它會儲存設定,例如同步處理的方向。每個用戶端只能要求所需的資料表,這可能不包括伺服器同步處理提供者所提供的所有資料表。例如有 20 個資料表,其中 10 個已為伺服器同步處理提供者設定了雙向同步處理。一個用戶端只能要求 12 個資料表,僅限下載。雖然伺服器支援上傳,但是用戶端不需要對所有資料表進行變更或同步處理。
範例
下列程式碼範例來自衍生自 SyncAgent 的類別。此程式碼會建立兩個同步處理群組及三個同步處理資料表。Customer 資料表會加入 Customer 群組,而 OrderHeader 和 OrderDetail 資料表會加入 Order 群組。所有的資料表僅供下載。如果用戶端上有資料表存在,則會卸除此資料表,並在初始同步處理期間重新建立。若要在完整範例的內容中檢視這段程式碼,請參閱 HOW TO:篩選資料列和資料行。
//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)
繼承階層
System. . :: . .Object
Microsoft.Synchronization.Data..::..SyncTable
執行緒安全性
這個類型的任何公用static (在 Visual Basic 中為 Shared) 成員都是安全執行緒。不保證任何執行個體成員都可以是安全執行緒。