DbSyncProvider.UpdateScopeCleanupTimestampCommand 属性
获取或设置一个 IDbCommand 对象,该对象包含的查询或存储过程更新 scope_info 表中特定作用域的 scope_cleanup_timestamp 列,以便标记该时间点直到为作用域执行了清除。
此属性不符合 CLS。
命名空间: Microsoft.Synchronization.Data
程序集: Microsoft.Synchronization.Data(在 microsoft.synchronization.data.dll 中)
语法
声明
Public Overridable Property UpdateScopeCleanupTimestampCommand As IDbCommand
用法
Dim instance As DbSyncProvider
Dim value As IDbCommand
value = instance.UpdateScopeCleanupTimestampCommand
instance.UpdateScopeCleanupTimestampCommand = value
public virtual IDbCommand UpdateScopeCleanupTimestampCommand { get; set; }
public:
virtual property IDbCommand^ UpdateScopeCleanupTimestampCommand {
IDbCommand^ get ();
void set (IDbCommand^ value);
}
/** @property */
public IDbCommand get_UpdateScopeCleanupTimestampCommand ()
/** @property */
public void set_UpdateScopeCleanupTimestampCommand (IDbCommand value)
public function get UpdateScopeCleanupTimestampCommand () : IDbCommand
public function set UpdateScopeCleanupTimestampCommand (value : IDbCommand)
属性值
包含查询或存储过程的 IDbCommand 对象。
示例
下面的代码示例指定了针对 UpdateScopeCleanupTimestampCommand 属性的一个命令。此命令和为 SelectOverlappingScopesCommand 属性指定的命令使得 Sync Framework 能够在一个表包括在多个作用域中的情况下适当处理清除。若要在完整示例上下文中查看此代码,请参见如何清除协作同步的元数据(非 SQL Server)。
SqlCommand updScopeCleanupInfoCmd = new SqlCommand();
updScopeCleanupInfoCmd.CommandType = CommandType.Text;
updScopeCleanupInfoCmd.CommandText = "UPDATE scope_info set " +
" scope_cleanup_timestamp = @" + DbSyncSession.SyncScopeCleanupTimestamp +
" WHERE scope_name = @" + DbSyncSession.SyncScopeName +
" AND(scope_cleanup_timestamp is null or scope_cleanup_timestamp < @" + DbSyncSession.SyncScopeCleanupTimestamp + ");" +
" SET @" + DbSyncSession.SyncRowCount + " = @@rowcount";
updScopeCleanupInfoCmd.Parameters.Add("@" + DbSyncSession.SyncScopeCleanupTimestamp, SqlDbType.BigInt);
updScopeCleanupInfoCmd.Parameters.Add("@" + DbSyncSession.SyncScopeName, SqlDbType.NVarChar, 100);
updScopeCleanupInfoCmd.Parameters.Add("@" + DbSyncSession.SyncRowCount, SqlDbType.Int).Direction = ParameterDirection.Output;
sampleDbProvider.UpdateScopeCleanupTimestampCommand = updScopeCleanupInfoCmd;
Dim updScopeCleanupInfoCmd As New SqlCommand()
With updScopeCleanupInfoCmd
.CommandType = CommandType.Text
.CommandText = "UPDATE scope_info set " _
& " scope_cleanup_timestamp = @" + DbSyncSession.SyncScopeCleanupTimestamp _
& " WHERE scope_name = @" + DbSyncSession.SyncScopeName _
& " AND(scope_cleanup_timestamp is null or scope_cleanup_timestamp < @" + DbSyncSession.SyncScopeCleanupTimestamp + ");" _
& " SET @" + DbSyncSession.SyncRowCount + " = @@rowcount"
.Parameters.Add("@" + DbSyncSession.SyncScopeCleanupTimestamp, SqlDbType.BigInt)
.Parameters.Add("@" + DbSyncSession.SyncScopeName, SqlDbType.NVarChar, 100)
.Parameters.Add("@" + DbSyncSession.SyncRowCount, SqlDbType.Int).Direction = ParameterDirection.Output
End With
sampleDbProvider.UpdateScopeCleanupTimestampCommand = updScopeCleanupInfoCmd
请参阅
参考
DbSyncProvider 类
DbSyncProvider 成员
Microsoft.Synchronization.Data 命名空间