Compartilhar via


Propriedade SyncConfiguration.SyncTables

Obtém SyncTableCollection de objetos SyncTable que contêm configurações como a direção da sincronização.

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

Sintaxe

'Declaração
Public ReadOnly Property SyncTables As SyncTableCollection
'Uso
Dim instance As SyncConfiguration
Dim value As SyncTableCollection

value = instance.SyncTables
public SyncTableCollection SyncTables { get; }
public:
property SyncTableCollection^ SyncTables {
    SyncTableCollection^ get ();
}
/** @property */
public SyncTableCollection get_SyncTables ()
public function get SyncTables () : SyncTableCollection

Valor da propriedade

SyncTableCollection de objetos SyncTable.

Exemplo

O exemplo de código a seguir é de uma classe derivada de SyncAgent. O código cria dois grupos de sincronização e três tabelas de sincronização. A tabela Customer é adicionada ao grupo Customer, e as tabelas OrderHeader e OrderDetail são adicionadas ao grupo Order. Todas as tabelas são somente para download. Se uma tabela já existir no cliente, ela será descartada e recriada durante a sincronização inicial. Para exibir esse código no contexto de um exemplo completo, consulte Como filtrar linhas e colunas.

//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)

Consulte também

Referência

Classe SyncConfiguration
Membros SyncConfiguration
Namespace Microsoft.Synchronization.Data