共用方式為


SyncTables 屬性

取得 SyncTable 物件的 SyncTableCollection,這些物件包含類似同步處理方向的設定。

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

語法

'宣告
Public ReadOnly Property SyncTables As SyncTableCollection
    Get
'用途
Dim instance As SyncConfiguration
Dim value As SyncTableCollection

value = instance.SyncTables
public SyncTableCollection SyncTables { get; }
public:
property SyncTableCollection^ SyncTables {
    SyncTableCollection^ get ();
}
member SyncTables : SyncTableCollection
function get SyncTables () : SyncTableCollection

屬性值

型別:Microsoft.Synchronization.Data. . :: . .SyncTableCollection
SyncTable 物件的 SyncTableCollection

範例

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

請參閱

參考

SyncConfiguration類別

SyncConfiguration 成員

Microsoft.Synchronization.Data 命名空間