DbSyncProvider.SelectScopeInfoCommand Property

Gets or sets an IDbCommand object that contains the query or stored procedure that returns scope metadata from the peer database.

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

public virtual IDbCommand SelectScopeInfoCommand { get; set; }

Property Value

Type: System.Data.IDbCommand
An IDbCommand object that contains a query or stored procedure.

This command returns information from the scope metadata table, such as the synchronization knowledge and cleanup knowledge that Sync Framework requires. For more information about how scope is used, see "Creating Tracking Tables to Store Metadata" in How to: Provision a Server Database for Collaborative Synchronization (Non-SQL Server).

The following code example specifies the command that selects metadata from the scope table in each peer database. To view this code in the context of a complete example, see How to: Provision a Server Database for Collaborative Synchronization (Non-SQL Server).

SqlCommand selReplicaInfoCmd = new SqlCommand();
selReplicaInfoCmd.CommandType = CommandType.Text;
selReplicaInfoCmd.CommandText = "SELECT " +
                                "scope_id, " +
                                "scope_local_id, " +
                                "scope_sync_knowledge, " +
                                "scope_tombstone_cleanup_knowledge, " +
                                "scope_timestamp " +
                                "FROM Sync.ScopeInfo " +
                                "WHERE scope_name = @" + DbSyncSession.SyncScopeName;
selReplicaInfoCmd.Parameters.Add("@" + DbSyncSession.SyncScopeName, SqlDbType.NVarChar, 100);

sampleProvider.SelectScopeInfoCommand = selReplicaInfoCmd;


Dim selReplicaInfoCmd As New SqlCommand()

With selReplicaInfoCmd
    .CommandType = CommandType.Text
    .CommandText = "SELECT " _
                 & "scope_id, " _
                 & "scope_local_id, " _
                 & "scope_sync_knowledge, " _
                 & "scope_tombstone_cleanup_knowledge, " _
                 & "scope_timestamp " _
                 & "FROM Sync.ScopeInfo " _
                 & "WHERE scope_name = @" + DbSyncSession.SyncScopeName
    .Parameters.Add("@" + DbSyncSession.SyncScopeName, SqlDbType.NVarChar, 100)
End With

sampleProvider.SelectScopeInfoCommand = selReplicaInfoCmd


Show: