Compartilhar via


Classe SyncConfiguration

Mantém as coleções de tabelas e parâmetros que são necessários para configurar os provedores de sincronização do cliente e do servidor.

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

Sintaxe

'Declaração
<SerializableAttribute> _
Public Class SyncConfiguration
'Uso
Dim instance As SyncConfiguration
[SerializableAttribute] 
public class SyncConfiguration
[SerializableAttribute] 
public ref class SyncConfiguration
/** @attribute SerializableAttribute() */ 
public class SyncConfiguration
SerializableAttribute 
public class SyncConfiguration

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 já existir uma tabela 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)

Hierarquia de herança

System.Object
  Microsoft.Synchronization.Data.SyncConfiguration

Segurança de thread

Qualquer membro estático público (Compartilhado no Visual Basic) deste tipo é protegido por thread. Não há garantia de que qualquer membro de instância esteja protegido por thread.

Consulte também

Referência

Membros SyncConfiguration
Namespace Microsoft.Synchronization.Data