Partager via


Classe SyncConfiguration

Gère les collections de tables et les paramètres qui sont requis pour configurer les fournisseurs de synchronisation client et serveur.

Espace de noms: Microsoft.Synchronization.Data
Assembly: Microsoft.Synchronization.Data (dans microsoft.synchronization.data.dll)

Syntaxe

'Déclaration
<SerializableAttribute> _
Public Class SyncConfiguration
'Utilisation
Dim instance As SyncConfiguration
[SerializableAttribute] 
public class SyncConfiguration
[SerializableAttribute] 
public ref class SyncConfiguration
/** @attribute SerializableAttribute() */ 
public class SyncConfiguration
SerializableAttribute 
public class SyncConfiguration

Exemple

L'exemple de code suivant provient d'une classe qui dérive de SyncAgent. Le code crée deux groupes de synchronisation et trois tables de synchronisation. La table Customer est ajoutée au groupe Customer, et les tables OrderHeader et OrderDetail sont ajoutées au groupe Order. Toutes les tables sont téléchargeables uniquement. Si une table existe au niveau du client, elle est supprimée, puis créée à nouveau lors de la synchronisation initiale. Pour afficher ce code dans le contexte d'un exemple complet, consultez Procédure : filtrer des lignes et des colonnes.

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

Hiérarchie d'héritage

System.Object
  Microsoft.Synchronization.Data.SyncConfiguration

Sécurité des threads

Tous les membres publics statiques (Partagés en Visual Basic) de ce type sont thread-safe. Il n'est pas garanti que les membres d'instance soient thread-safe.

Voir aussi

Référence

Membres SyncConfiguration
Espace de noms Microsoft.Synchronization.Data