Share via


DbSyncProvider.UpdateScopeCleanupTimestampCommand Property

Gets or sets an IDbCommand object that contains the query or stored procedure that updates the scope_cleanup_timestamp column for a particular scope in the scope_info table, to mark the point up to which cleanup has been performed for the scope.

This property is not CLS-compliant.  

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

Syntax

'Declaration
Public Overridable Property UpdateScopeCleanupTimestampCommand As IDbCommand
'Usage
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)

Property Value

An IDbCommand object that contains a query or stored procedure.

Example

The following code example specifies a command for the UpdateScopeCleanupTimestampCommand property. This command and the command that is specified for the SelectOverlappingScopesCommand 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 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

See Also

Reference

DbSyncProvider Class
DbSyncProvider Members
Microsoft.Synchronization.Data Namespace