DbSyncProvider.SelectOverlappingScopesCommand Property
Gets or sets an IDbCommand object that contains the query or stored procedure that returns the scope name and table name for all tables in the specified scope that are also included in other scopes.
This property is not CLS-compliant.
Namespace: Microsoft.Synchronization.Data
Assembly: Microsoft.Synchronization.Data (in microsoft.synchronization.data.dll)
Syntax
'Declaration
Public Overridable Property SelectOverlappingScopesCommand As IDbCommand
'Usage
Dim instance As DbSyncProvider
Dim value As IDbCommand
value = instance.SelectOverlappingScopesCommand
instance.SelectOverlappingScopesCommand = value
public virtual IDbCommand SelectOverlappingScopesCommand { get; set; }
public:
virtual property IDbCommand^ SelectOverlappingScopesCommand {
IDbCommand^ get ();
void set (IDbCommand^ value);
}
/** @property */
public IDbCommand get_SelectOverlappingScopesCommand ()
/** @property */
public void set_SelectOverlappingScopesCommand (IDbCommand value)
public function get SelectOverlappingScopesCommand () : IDbCommand
public function set SelectOverlappingScopesCommand (value : IDbCommand)
Property Value
An IDbCommand object that contains a query or stored procedure.
Example
The following code example specifies a command for the SelectOverlappingScopesCommand property. This command and the command that is specified for the UpdateScopeCleanupTimestampCommand property enable Sync Framework to handle cleanup appropriately in cases where a table is included in more than one scope. To view this code in the context of a complete example, see How to: Clean Up Metadata for Collaborative Synchronization (Non-SQL Server).
SqlCommand overlappingScopesCmd = new SqlCommand();
overlappingScopesCmd.CommandType = CommandType.StoredProcedure;
overlappingScopesCmd.CommandText = "Sync.sp_SelectSharedScopes";
overlappingScopesCmd.Parameters.Add("@" + DbSyncSession.SyncScopeName, SqlDbType.NVarChar, 100);
sampleDbProvider.SelectOverlappingScopesCommand = overlappingScopesCmd;
Dim overlappingScopesCmd As New SqlCommand()
With overlappingScopesCmd
.CommandType = CommandType.StoredProcedure
.CommandText = "Sync.sp_SelectSharedScopes"
.Parameters.Add("@" + DbSyncSession.SyncScopeName, SqlDbType.NVarChar, 100)
End With
sampleDbProvider.SelectOverlappingScopesCommand = overlappingScopesCmd
The following code example creates the stored procedure that is called by the overlapping scopes command.
CREATE PROCEDURE Sync.sp_SelectSharedScopes
@sync_scope_name nvarchar(100)
AS
SELECT ScopeTableMap2.table_name AS sync_table_name,
ScopeTableMap2.scope_name AS sync_shared_scope_name
FROM Sync.ScopeTableMap ScopeTableMap1 JOIN Sync.ScopeTableMap ScopeTableMap2
ON ScopeTableMap1.table_name = ScopeTableMap2.table_name
AND ScopeTableMap1.scope_name = @sync_scope_name
WHERE ScopeTableMap2.scope_name <> @sync_scope_name
See Also
Reference
DbSyncProvider Class
DbSyncProvider Members
Microsoft.Synchronization.Data Namespace