DbSyncProvider.CleanupMetadata 方法

此方法不符合 CLS。  

命名空间: Microsoft.Synchronization.Data
程序集: Microsoft.Synchronization.Data(在 microsoft.synchronization.data.dll 中)

语法

声明
<SuppressMessageAttribute("Microsoft.Globalization", "CA1303:DoNotPassLiteralsAsLocalizedParameters")> _
Public Overridable Function CleanupMetadata As Boolean
用法
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

返回值

如果成功地运行了元数据清除,则为 true;否则为 false

示例

下面的代码示例调用 CleanupMetadata 方法。该代码对提供程序进行实例化,并调用 SampleSyncProvider 类中的 ConfigureDbSyncProvider 方法。所有所需的 DbSyncAdapterDbSyncProvider 属性均在此类中定义。其中包括 SelectMetadataForCleanupCommand 属性。传递给 ConfigureDbSyncProvider 方法的值 7 是以天为单位的元数据保持期。

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

请参阅

参考

DbSyncProvider 类
DbSyncProvider 成员
Microsoft.Synchronization.Data 命名空间