DbSyncProvider.SelectScopeInfoCommand Property
Gets or sets an IDbCommand object that contains the query or stored procedure that returns scope metadata from the peer database.
This property is not CLS-compliant.
Namespace: Microsoft.Synchronization.Data
Assembly: Microsoft.Synchronization.Data (in microsoft.synchronization.data.dll)
Syntax
'Declaration
Public Property SelectScopeInfoCommand As IDbCommand
'Usage
Dim instance As DbSyncProvider
Dim value As IDbCommand
value = instance.SelectScopeInfoCommand
instance.SelectScopeInfoCommand = value
public IDbCommand SelectScopeInfoCommand { get; set; }
public:
property IDbCommand^ SelectScopeInfoCommand {
IDbCommand^ get ();
void set (IDbCommand^ value);
}
/** @property */
public IDbCommand get_SelectScopeInfoCommand ()
/** @property */
public void set_SelectScopeInfoCommand (IDbCommand value)
public function get SelectScopeInfoCommand () : IDbCommand
public function set SelectScopeInfoCommand (value : IDbCommand)
Property Value
An IDbCommand object that contains a query or stored procedure.
Remarks
This command returns information from the scope metadata table, such as the synchronization knowledge and cleanup knowledge that Sync Services requires. For more information about how scope is used, see "Creating Tracking Tables to Store Metadata" in How to: Configure Change Tracking and Synchronize Peers.
Example
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: Configure Change Tracking and Synchronize Peers.
SqlCommand selReplicaInfoCmd = new SqlCommand();
selReplicaInfoCmd.CommandType = CommandType.Text;
selReplicaInfoCmd.CommandText = "SELECT " +
"@" + DbSyncSession.SyncScopeId + " = scope_id, " +
"@" + DbSyncSession.SyncScopeKnowledge + " = scope_sync_knowledge, " +
"@" + DbSyncSession.SyncScopeCleanupKnowledge + " = scope_tombstone_cleanup_knowledge, " +
"@" + DbSyncSession.SyncScopeTimestamp + " = scope_timestamp " +
"FROM Sales.ScopeInfo " +
"WHERE scope_name = @" + DbSyncSession.SyncScopeName;
selReplicaInfoCmd.Parameters.Add("@" + DbSyncSession.SyncScopeName, SqlDbType.NVarChar, 100);
selReplicaInfoCmd.Parameters.Add("@" + DbSyncSession.SyncScopeId, SqlDbType.UniqueIdentifier).Direction = ParameterDirection.Output;
selReplicaInfoCmd.Parameters.Add("@" + DbSyncSession.SyncScopeKnowledge, SqlDbType.VarBinary, 10000).Direction = ParameterDirection.Output;
selReplicaInfoCmd.Parameters.Add("@" + DbSyncSession.SyncScopeCleanupKnowledge, SqlDbType.VarBinary, 10000).Direction = ParameterDirection.Output;
selReplicaInfoCmd.Parameters.Add("@" + DbSyncSession.SyncScopeTimestamp, SqlDbType.BigInt).Direction = ParameterDirection.Output;
peerProvider.SelectScopeInfoCommand = selReplicaInfoCmd;
Dim selReplicaInfoCmd As New SqlCommand()
With selReplicaInfoCmd
.CommandType = CommandType.Text
.CommandText = "SELECT " _
& "@" + DbSyncSession.SyncScopeId + " = scope_id, " _
& "@" + DbSyncSession.SyncScopeKnowledge + " = scope_sync_knowledge, " _
& "@" + DbSyncSession.SyncScopeCleanupKnowledge + " = scope_tombstone_cleanup_knowledge, " _
& "@" + DbSyncSession.SyncScopeTimestamp + " = scope_timestamp " _
& "FROM Sales.ScopeInfo " _
& "WHERE scope_name = @" + DbSyncSession.SyncScopeName
.Parameters.Add("@" + DbSyncSession.SyncScopeName, SqlDbType.NVarChar, 100)
.Parameters.Add("@" + DbSyncSession.SyncScopeId, SqlDbType.UniqueIdentifier).Direction = ParameterDirection.Output
.Parameters.Add("@" + DbSyncSession.SyncScopeKnowledge, SqlDbType.VarBinary, 10000).Direction = ParameterDirection.Output
.Parameters.Add("@" + DbSyncSession.SyncScopeCleanupKnowledge, SqlDbType.VarBinary, 10000).Direction = ParameterDirection.Output
.Parameters.Add("@" + DbSyncSession.SyncScopeTimestamp, SqlDbType.BigInt).Direction = ParameterDirection.Output
End With
peerProvider.SelectScopeInfoCommand = selReplicaInfoCmd
See Also
Reference
DbSyncProvider Class
DbSyncProvider Members
Microsoft.Synchronization.Data Namespace