Export (0) Print
Expand All

DbSyncProvider.UpdateScopeInfoCommand Property

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

This property is not CLS-compliant.  

Namespace: Microsoft.Synchronization.Data
Assembly: Microsoft.Synchronization.Data (in microsoft.synchronization.data.dll)

public virtual IDbCommand UpdateScopeInfoCommand { get; set; }
/** @property */
public IDbCommand get_UpdateScopeInfoCommand ()

/** @property */
public void set_UpdateScopeInfoCommand (IDbCommand value)

public function get UpdateScopeInfoCommand () : IDbCommand

public function set UpdateScopeInfoCommand (value : IDbCommand)

Property Value

An 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;

Show:
© 2014 Microsoft