DbSyncProvider.CleanupMetadata Method
Removes change tracking metadata from the database and updates the cleanup knowledge to reflect the point where the cleanup process stopped. This enables outdated nodes to be identified.
This method is not CLS-compliant.
Namespace: Microsoft.Synchronization.Data
Assembly: Microsoft.Synchronization.Data (in microsoft.synchronization.data.dll)
Syntax
'Declaration
<SuppressMessageAttribute("Microsoft.Globalization", "CA1303:DoNotPassLiteralsAsLocalizedParameters")> _
Public Overridable Function CleanupMetadata As Boolean
'Usage
Dim instance As DbSyncProvider
Dim returnValue As Boolean
returnValue = instance.CleanupMetadata
[SuppressMessageAttribute("Microsoft.Globalization", "CA1303:DoNotPassLiteralsAsLocalizedParameters")]
public virtual bool CleanupMetadata ()
[SuppressMessageAttribute(L"Microsoft.Globalization", L"CA1303:DoNotPassLiteralsAsLocalizedParameters")]
public:
virtual bool CleanupMetadata ()
/** @attribute SuppressMessageAttribute("Microsoft.Globalization", "CA1303:DoNotPassLiteralsAsLocalizedParameters") */
public boolean CleanupMetadata ()
SuppressMessageAttribute("Microsoft.Globalization", "CA1303:DoNotPassLiteralsAsLocalizedParameters")
public function CleanupMetadata () : boolean
Return Value
true if metadata cleanup ran successfully; otherwise false.
Example
The following code example calls the CleanupMetadata method. The code instantiates a provider and calls the ConfigureDbSyncProvider
method in the SampleSyncProvider
class. All the required DbSyncAdapter and DbSyncProvider properties are defined in this class. This includes the SelectMetadataForCleanupCommand property. The value of 7
that is passed to the ConfigureDbSyncProvider
method is the metadata retention period in days.
sampleSyncProvider = new SampleSyncProvider();
DbSyncProvider provider1 = sampleSyncProvider.ConfigureDbSyncProvider(Utility.ConnStr_DbSync1, 7);
if (provider1.CleanupMetadata() == true)
{
Console.WriteLine(String.Empty);
Console.WriteLine("Metadata cleanup ran in the SyncSamplesDb_Peer1 database.");
Console.WriteLine("Metadata more than 7 days old was deleted.");
}
else
{
Console.WriteLine("Metadata cleanup failed, most likely due to concurrency issues.");
}
sampleSyncProvider = New SampleSyncProvider()
Dim provider1 As DbSyncProvider = sampleSyncProvider.ConfigureDbSyncProvider(Utility.ConnStr_DbSync1, 7)
If provider1.CleanupMetadata() = True Then
Console.WriteLine([String].Empty)
Console.WriteLine("Metadata cleanup ran in the SyncSamplesDb_Peer1 database.")
Console.WriteLine("Metadata more than 7 days old was deleted.")
Else
Console.WriteLine("Metadata cleanup failed, most likely due to concurrency issues.")
End If
See Also
Reference
DbSyncProvider Class
DbSyncProvider Members
Microsoft.Synchronization.Data Namespace