Aracılığıyla paylaş


PurgeType Enumeration

Specifies the criteria to use to purge metadata when using the PurgeTombstoneTableData method or the PurgeTransactionSequenceData method of the SqlCeChangeTracking class.

Namespace:  System.Data.SqlServerCe
Assembly:  System.Data.SqlServerCe (in System.Data.SqlServerCe.dll)

Syntax

'Declaration
Public Enumeration PurgeType
'Usage
Dim instance As PurgeType
public enum PurgeType
public enum class PurgeType
type PurgeType
public enum PurgeType

Members

Member name Description
None This value is reserved for use by the tracking infrastructure. Do not use it in your code.
TimeBased Specifies that metadata will be deleted based on whether it is older than a specified number of days.
CsnBased Specifies that metadata will be deleted based on the Commit Sequence Number (CSN) of the last transaction to modify it.
Max This value is reserved for use by the tracking infrastructure. Do not use it in your code.

Remarks

A time-based purge deletes the metadata, when the metadata is older than a specified number of days. For example, in an application that uses tracking to implement sync, tracking data is no longer needed after the data is synched to the server (or a set of peers). The application could retain tracking data only for a specific number of days (n) and impose a restriction on users that they sync with the server (or the set of peers) at least every n days.

A CSN-based purge deletes the metadata, when the metadata is modified last by a transaction, with a CSN that is less than or equal to a specified CSN. The CSN associated with a row indicates the commit order of the transactions in which the database has been enlisted. In a CSN-based purge, data is deleted based on commit sequence, not time sequence. For example, if a row was modified last by a transaction that committed 100 transactions ago from current time, it may no longer be needed.

CSN-based cleanup makes sense because changes made by transactions are visible to an application only after the transaction is committed. For example, a notifications application built on change tracking can notify subscribers about changes only after a transaction that has changed data commits. The application could retain a buffer of the last 100 transactions, to allow for subscribers to respond to the notifications, and purge anything older than that.

A time-based purge is not equivalent to CSN-based purge because the timestamp of a row is assigned at the time of an insert or update. In the case of a long running transaction, the commit time can differ significantly from the timestamp value of the modified row. A CSN-based purge does not delete metadata until after the transaction has committed.

See Also

Reference

System.Data.SqlServerCe Namespace

PurgeTombstoneTableData

PurgeTransactionSequenceData