MetadataSchema 屬性
在衍生類別中覆寫時,會取得代表項目之中繼資料結構描述的 ItemMetadataSchema 物件。
命名空間: Microsoft.Synchronization.SimpleProviders
組件: Microsoft.Synchronization.SimpleProviders (在 Microsoft.Synchronization.SimpleProviders.dll 中)
語法
'宣告
Public MustOverride ReadOnly Property MetadataSchema As ItemMetadataSchema
Get
'用途
Dim instance As SimpleSyncProvider
Dim value As ItemMetadataSchema
value = instance.MetadataSchema
public abstract ItemMetadataSchema MetadataSchema { get; }
public:
virtual property ItemMetadataSchema^ MetadataSchema {
ItemMetadataSchema^ get () abstract;
}
abstract MetadataSchema : ItemMetadataSchema
abstract function get MetadataSchema () : ItemMetadataSchema
屬性值
型別:Microsoft.Synchronization.SimpleProviders. . :: . .ItemMetadataSchema
代表項目之中繼資料結構描述的 ItemMetadataSchema 物件。
備註
Sync Framework 會將項目存放區資料或是您建立的其他中繼資料對應到內部中繼資料存放區識別碼和版本,其方式是使用 MetadataSchema 屬性所公開的 ItemMetadataSchema 物件。如需詳細資訊,請參閱管理簡單提供者的中繼資料。
範例
下列程式碼範例會提供 ItemMetadataSchema 物件的輸入。範例程式碼中的常數會定義項目存放區中每一個資料行的整數值。這些值是在建立自訂欄位定義和 ItemMetadataSchema 物件的識別規則時使用。若要在完整應用程式的內容中檢視這段程式碼,請參閱 Sync Framework SDK 及 Code Gallery 中的 "Sync101 using Simple Sync Provider" 應用程式。
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