DbSyncProvider.SelectOverlappingScopesCommand 属性
获取或设置一个 IDbCommand 对象,该对象包含的查询或存储过程返回指定作用域中也在其他作用域中包括的所有表的作用域名称和表名称。
此属性不符合 CLS。
命名空间: Microsoft.Synchronization.Data
程序集: Microsoft.Synchronization.Data(在 microsoft.synchronization.data.dll 中)
语法
声明
Public Overridable Property SelectOverlappingScopesCommand As IDbCommand
用法
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)
属性值
包含查询或存储过程的 IDbCommand 对象。
示例
下面的代码示例指定了针对 SelectOverlappingScopesCommand 属性的一个命令。此命令和为 UpdateScopeCleanupTimestampCommand 属性指定的命令使得 Sync Framework 能够在一个表包括在多个作用域中的情况下适当处理清除。若要在完整示例上下文中查看此代码,请参见如何清除协作同步的元数据(非 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
下面的代码示例创建由重叠作用域命令调用的存储过程。
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
请参阅
参考
DbSyncProvider 类
DbSyncProvider 成员
Microsoft.Synchronization.Data 命名空间