SimpleSyncProvider.MetadataSchema 属性

在派生类中重写时,获取表示某一项的元数据架构的 ItemMetadataSchema 对象。

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

语法

声明
Public MustOverride ReadOnly Property MetadataSchema As ItemMetadataSchema
用法
Dim instance As SimpleSyncProvider
Dim value As ItemMetadataSchema

value = instance.MetadataSchema
public abstract ItemMetadataSchema MetadataSchema { get; }
public:
virtual property ItemMetadataSchema^ MetadataSchema {
    ItemMetadataSchema^ get () abstract;
}
/** @property */
public abstract ItemMetadataSchema get_MetadataSchema ()
public abstract function get MetadataSchema () : ItemMetadataSchema

属性值

一个表示某一项的元数据架构的 ItemMetadataSchema 对象。

备注

Sync Framework 通过使用由 MetadataSchema 属性公开的 ItemMetadataSchema 对象,将项存储区数据或您创建的其他元数据映射为内部元数据存储区 ID 和版本。有关更多信息,请参见管理简单提供程序的元数据

示例

下面的代码示例提供了 ItemMetadataSchema 对象的输入。示例代码中的常量为项存储区中的每列定义一个整数值。当为 ItemMetadataSchema 对象创建自定义字段定义和标识值时,将使用这些值。若要在完整应用程序的上下文中查看此代码,请参见"Sync101 using Simple Sync Provider" 应用程序(可从 Sync Framework SDK 和 Code Gallery 获得)。

public const uint CUSTOM_FIELD_ID = 1;
public const uint CUSTOM_FIELD_TIMESTAMP = 2;
public override ItemMetadataSchema MetadataSchema
{
    get
    {
        CustomFieldDefinition[] customFields = new CustomFieldDefinition[2];
        customFields[0] = new CustomFieldDefinition(CUSTOM_FIELD_ID, typeof(ulong));
        customFields[1] = new CustomFieldDefinition(CUSTOM_FIELD_TIMESTAMP, typeof(ulong));

        IdentityRule[] identityRule = new IdentityRule[1];
        identityRule[0] = new IdentityRule(new uint[] { CUSTOM_FIELD_ID });

        return new ItemMetadataSchema(customFields, identityRule);
    }
}
Public Const CUSTOM_FIELD_ID As UInteger = 1
Public Const CUSTOM_FIELD_TIMESTAMP As UInteger = 2
Public Overrides ReadOnly Property MetadataSchema() As ItemMetadataSchema
    Get
        Dim customFields As CustomFieldDefinition() = New CustomFieldDefinition(1) {}
        customFields(0) = New CustomFieldDefinition(CUSTOM_FIELD_ID, GetType(ULong))
        customFields(1) = New CustomFieldDefinition(CUSTOM_FIELD_TIMESTAMP, GetType(ULong))

        Dim identityRule As IdentityRule() = New IdentityRule(0) {}
        identityRule(0) = New IdentityRule(New UInteger() {CUSTOM_FIELD_ID})

        Return New ItemMetadataSchema(customFields, identityRule)
    End Get
End Property

请参阅

参考

SimpleSyncProvider 类
SimpleSyncProvider 成员
Microsoft.Synchronization.SimpleProviders 命名空间