DbSyncProvider::UpdateScopeInfoCommand Property
Gets or sets an IDbCommand object that contains the query or stored procedure that updates scope metadata in the peer database.
Assembly: Microsoft.Synchronization.Data (in Microsoft.Synchronization.Data.dll)
public: virtual property IDbCommand^ UpdateScopeInfoCommand { IDbCommand^ get (); void set (IDbCommand^ value); }
Property Value
Type: System.Data::IDbCommandAn IDbCommand object that contains a query or stored procedure.
This command updates 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 updates metadata in 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 updReplicaInfoCmd = new SqlCommand(); updReplicaInfoCmd.CommandType = CommandType.Text; updReplicaInfoCmd.CommandText = "UPDATE Sync.ScopeInfo SET " + "scope_sync_knowledge = @" + DbSyncSession.SyncScopeKnowledge + ", " + "scope_id = @" + DbSyncSession.SyncScopeId + ", " + "scope_tombstone_cleanup_knowledge = @" + DbSyncSession.SyncScopeCleanupKnowledge + " " + "WHERE scope_name = @" + DbSyncSession.SyncScopeName + " AND " + " ( @" + DbSyncSession.SyncCheckConcurrency + " = 0 OR scope_timestamp = @" + DbSyncSession.SyncScopeTimestamp + "); " + "set @" + DbSyncSession.SyncRowCount + " = @@rowcount"; updReplicaInfoCmd.Parameters.Add("@" + DbSyncSession.SyncScopeKnowledge, SqlDbType.VarBinary, 10000); updReplicaInfoCmd.Parameters.Add("@" + DbSyncSession.SyncScopeCleanupKnowledge, SqlDbType.VarBinary, 10000); updReplicaInfoCmd.Parameters.Add("@" + DbSyncSession.SyncScopeName, SqlDbType.NVarChar, 100); updReplicaInfoCmd.Parameters.Add("@" + DbSyncSession.SyncCheckConcurrency, SqlDbType.Int); updReplicaInfoCmd.Parameters.Add("@" + DbSyncSession.SyncScopeId, SqlDbType.UniqueIdentifier); updReplicaInfoCmd.Parameters.Add("@" + DbSyncSession.SyncScopeTimestamp, SqlDbType.BigInt); updReplicaInfoCmd.Parameters.Add("@" + DbSyncSession.SyncRowCount, SqlDbType.Int).Direction = ParameterDirection.Output; sampleProvider.UpdateScopeInfoCommand = updReplicaInfoCmd;
Dim updReplicaInfoCmd As New SqlCommand() With updReplicaInfoCmd .CommandType = CommandType.Text .CommandText = "UPDATE Sync.ScopeInfo SET " _ & "scope_sync_knowledge = @" + DbSyncSession.SyncScopeKnowledge + ", " _ & "scope_id = @" + DbSyncSession.SyncScopeId + ", " _ & "scope_tombstone_cleanup_knowledge = @" + DbSyncSession.SyncScopeCleanupKnowledge + " " _ & "WHERE scope_name = @" + DbSyncSession.SyncScopeName + " AND " _ & " ( @" + DbSyncSession.SyncCheckConcurrency + " = 0 OR scope_timestamp = @" + DbSyncSession.SyncScopeTimestamp + "); " _ & "set @" + DbSyncSession.SyncRowCount + " = @@rowcount" .Parameters.Add("@" + DbSyncSession.SyncScopeKnowledge, SqlDbType.VarBinary, 10000) .Parameters.Add("@" + DbSyncSession.SyncScopeCleanupKnowledge, SqlDbType.VarBinary, 10000) .Parameters.Add("@" + DbSyncSession.SyncScopeName, SqlDbType.NVarChar, 100) .Parameters.Add("@" + DbSyncSession.SyncCheckConcurrency, SqlDbType.Int) .Parameters.Add("@" + DbSyncSession.SyncScopeId, SqlDbType.UniqueIdentifier) .Parameters.Add("@" + DbSyncSession.SyncScopeTimestamp, SqlDbType.BigInt) .Parameters.Add("@" + DbSyncSession.SyncRowCount, SqlDbType.Int).Direction = ParameterDirection.Output End With sampleProvider.UpdateScopeInfoCommand = updReplicaInfoCmd
Show: