Click to Rate and Give Feedback
Collapse All/Expand All Collapse All
Other versions are also available for the following:
SqlSyncAdapterBuilder Class

Creates a SyncAdapter and the SQL commands that are required to synchronize a client with a SQL Server database.

Namespace: Microsoft.Synchronization.Data.Server
Assembly: Microsoft.Synchronization.Data.Server (in microsoft.synchronization.data.server.dll)
Visual Basic (Declaration)
Public Class SqlSyncAdapterBuilder
    Inherits Component
Visual Basic (Usage)
Dim instance As SqlSyncAdapterBuilder
C#
public class SqlSyncAdapterBuilder : Component
C++
public ref class SqlSyncAdapterBuilder : public Component
J#
public class SqlSyncAdapterBuilder extends Component
JScript
public class SqlSyncAdapterBuilder extends Component

The synchronization adapter builder is modeled after the command builder in ADO.NET. You can use this tool to develop code for the synchronization commands that are executed by the server synchronization provider. The synchronization adapter builder produces SELECT, INSERT, UPDATE, and DELETE statements for SQL Server databases based on information that you provide about the tables that are involved in synchronization. The synchronization adapter builder enables you to specify the following information:

  • The tables that you want to synchronize

  • The tracking columns in those tables

  • The direction of synchronization

  • Which rows and columns to include

The synchronization adapter builder uses this information to create a synchronization adapter and Transact-SQL commands. The synchronization adapter builder is compatible with SQL Server 2000 and later versions.

NoteNote

You can use the synchronization adapter builder to become familiar with synchronization commands. However, if you can, we recommend that you manually specify commands that use stored procedures. Stored procedures can help improve the performance and security of the application.

The following code example creates a SyncAdapter object for the Customer table by using the SqlSyncAdapterBuilder. Columns in the table are specified for several properties, and synchronization is specified as bidirectional. To view this code in the context of a complete example, see How to: Work with Events and Program Business Logic.

C#
SqlSyncAdapterBuilder customerBuilder = new SqlSyncAdapterBuilder(serverConn);

customerBuilder.TableName = "Sales.Customer";
customerBuilder.TombstoneTableName = customerBuilder.TableName + "_Tombstone";
customerBuilder.SyncDirection = SyncDirection.Bidirectional;
customerBuilder.CreationTrackingColumn = "InsertTimestamp";
customerBuilder.UpdateTrackingColumn = "UpdateTimestamp";
customerBuilder.DeletionTrackingColumn = "DeleteTimestamp";
customerBuilder.CreationOriginatorIdColumn = "InsertId";
customerBuilder.UpdateOriginatorIdColumn = "UpdateId";
customerBuilder.DeletionOriginatorIdColumn = "DeleteId";

SyncAdapter customerSyncAdapter = customerBuilder.ToSyncAdapter();
customerSyncAdapter.TableName = "Customer";
this.SyncAdapters.Add(customerSyncAdapter);
Visual Basic
Dim customerBuilder As New SqlSyncAdapterBuilder(serverConn)
With customerBuilder
    .TableName = "Sales.Customer"
    .TombstoneTableName = customerBuilder.TableName + "_Tombstone"
    .SyncDirection = SyncDirection.Bidirectional
    .CreationTrackingColumn = "InsertTimestamp"
    .UpdateTrackingColumn = "UpdateTimestamp"
    .DeletionTrackingColumn = "DeleteTimestamp"
    .CreationOriginatorIdColumn = "InsertId"
    .UpdateOriginatorIdColumn = "UpdateId"
    .DeletionOriginatorIdColumn = "DeleteId"
End With

Dim customerSyncAdapter As SyncAdapter = customerBuilder.ToSyncAdapter()
customerSyncAdapter.TableName = "Customer"
Me.SyncAdapters.Add(customerSyncAdapter)
System.Object
   System.MarshalByRefObject
     System.ComponentModel.Component
      Microsoft.Synchronization.Data.Server.SqlSyncAdapterBuilder
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
© 2010 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker