Freigeben über


SyncTable-Klasse

Stellt die Clienteinstellungen für eine Tabelle dar, die an der Synchronisierung beteiligt ist.

Namespace:  Microsoft.Synchronization.Data
Assembly:  Microsoft.Synchronization.Data (in Microsoft.Synchronization.Data.dll)

Syntax

'Declaration
<SerializableAttribute> _
Public Class SyncTable
'Usage
Dim instance As SyncTable
[SerializableAttribute]
public class SyncTable
[SerializableAttribute]
public ref class SyncTable
[<SerializableAttribute>]
type SyncTable =  class end
public class SyncTable

Hinweise

Für jede Tabelle, die synchronisiert wird, wird eine Synchronisierungstabelle definiert. Sie dient zum Speichern von Einstellungen, wie z. B. der Synchronisierungsrichtung. Jeder Client kann nur die Tabellen anfordern, die er benötigt. Unter Umständen werden so nicht alle Tabellen angefordert, die der Serversynchronisierungsanbieter verfügbar macht. So wäre z. B. ein Fall mit 20 Tabellen denkbar, von denen 10 Tabellen im Serversynchronisierungsanbieter für die bidirektionale Synchronisierung konfiguriert sind. Ein Client könnte dann nur 12 der Tabellen für Nur-Download-Synchronisierungen anfordern. Auch wenn der Server Hochladevorgänge unterstützt, muss der Client keine Änderungen vornehmen, und er muss auch nicht alle Tabellen synchronisieren.

Beispiele

Das folgende Codebeispiel stammt aus einer Klasse, die von der SyncAgent-Klasse abgeleitet ist. Der Code erstellt zwei Synchronisierungsgruppen und drei Synchronisierungstabellen. Die Customer-Tabelle wird der Customer-Gruppe und die OrderHeader-Tabelle sowie die OrderDetail-Tabelle werden der Order-Gruppe hinzugefügt. Alle Tabellen können nur heruntergeladen werden. Wenn eine Tabelle auf einem Client vorhanden ist, wird sie verworfen und während der ersten Synchronisierung neu erstellt. Eine Darstellung dieses Codes im Kontext eines vollständigen Beispiels finden Sie unter Vorgehensweise: Filtern von Zeilen und Spalten.

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

Vererbungshierarchie

System. . :: . .Object
  Microsoft.Synchronization.Data..::..SyncTable

Threadsicherheit

Alle öffentlichen static (Shared in Visual Basic) Member dieses Typs sind threadsicher. Bei Instanzmembern ist die Threadsicherheit nicht gewährleistet.

Siehe auch

Verweis

SyncTable-Member

Microsoft.Synchronization.Data-Namespace