Condividi tramite


Proprietà DbSyncProvider.UpdateScopeCleanupTimestampCommand

Ottiene o imposta un oggetto IDbCommand contenente la query o la stored procedure che aggiorna la colonna scope_cleanup_timestamp per un particolare ambito nella tabella scope_info, per contrassegnare il punto fino al quale è stata eseguita la pulizia per l'ambito.

Questa proprietà non è conforme a CLS.  

Spazio dei nomi: Microsoft.Synchronization.Data
Assembly: Microsoft.Synchronization.Data (in microsoft.synchronization.data.dll)

Sintassi

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

Valore proprietà

Oggetto IDbCommand contenente una query o una stored procedure.

Esempio

Nell'esempio di codice seguente viene specificato un comando per la proprietà UpdateScopeCleanupTimestampCommand. Questo e il comando specificato per la proprietà SelectOverlappingScopesCommand consentono a Sync Framework di gestire in modo appropriato la pulizia nei casi in cui una tabella sia inclusa in più di un ambito. Per visualizzare questo codice nel contesto di un esempio completo, vedere Procedura: pulire i metadati per la sincronizzazione in scenari di collaborazione (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

Vedere anche

Riferimento

Classe DbSyncProvider
Membri DbSyncProvider
Spazio dei nomi Microsoft.Synchronization.Data