共用方式為


SyncConfiguration 類別

維護設定用戶端和伺服器同步處理提供者所需的資料表和參數集合。

命名空間:  Microsoft.Synchronization.Data
組件:  Microsoft.Synchronization.Data (在 Microsoft.Synchronization.Data.dll 中)

語法

'宣告
<SerializableAttribute> _
Public Class SyncConfiguration
'用途
Dim instance As SyncConfiguration
[SerializableAttribute]
public class SyncConfiguration
[SerializableAttribute]
public ref class SyncConfiguration
[<SerializableAttribute>]
type SyncConfiguration =  class end
public class SyncConfiguration

範例

下列程式碼範例來自衍生自 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..::..SyncConfiguration

執行緒安全性

這個類型的任何公用static (在 Visual Basic 中為 Shared) 成員都是安全執行緒。不保證任何執行個體成員都可以是安全執行緒。

請參閱

參考

SyncConfiguration 成員

Microsoft.Synchronization.Data 命名空間