Share via


ItemMetadataSchema Class

Represents the metadata schema for an item, including how to identify an item and its version information, and how change units are defined.

Inheritance Hierarchy

System.Object
  Microsoft.Synchronization.SimpleProviders.ItemMetadataSchema

Namespace:  Microsoft.Synchronization.SimpleProviders
Assembly:  Microsoft.Synchronization.SimpleProviders (in Microsoft.Synchronization.SimpleProviders.dll)

Syntax

'Declaration
Public Class ItemMetadataSchema
'Usage
Dim instance As ItemMetadataSchema
public class ItemMetadataSchema
public ref class ItemMetadataSchema
type ItemMetadataSchema =  class end
public class ItemMetadataSchema

The ItemMetadataSchema type exposes the following members.

Constructors

  Name Description
Public method ItemMetadataSchema(IEnumerable<CustomFieldDefinition>, IEnumerable<IdentityRule>) Initializes a new instance of the ItemMetadataSchema class that contains information about custom fields and how to identify an item.
Public method ItemMetadataSchema(IEnumerable<CustomFieldDefinition>, IEnumerable<IdentityRule>, IEnumerable<ChangeUnitVersionDefinition>) Initializes a new instance of the ItemMetadataSchema class that contains information about custom fields, how to identify an item, and how change units are defined.

Top

Properties

  Name Description
Public property ChangeUnitVersionDefinitions Gets a collection of ChangeUnitVersionDefinition objects that represent the way in which a change unit is identified in terms of an ID, an ID format, and a set of fields that define a change unit's version.
Public property CustomFields Gets a collection of CustomFieldDefinition objects that each represent a custom field. Fields can be used to identify an item in the metadata or store version information about an item.
Public property IdentityRules Gets a collection of IdentityRule objects that defines the way in which an item is identified within a replica.

Top

Methods

  Name Description
Public method Equals (Inherited from Object.)
Protected method Finalize (Inherited from Object.)
Public method GetHashCode (Inherited from Object.)
Public method GetType (Inherited from Object.)
Protected method MemberwiseClone (Inherited from Object.)
Public method ToString (Inherited from Object.)

Top

Remarks

Sync Framework maps item store data, or additional metadata that you create, to internal metadata store IDs and versions by using an ItemMetadataSchema object that is exposed by the MetadataSchema property. For more information about simple provider metadata, see Managing Metadata for Simple Providers.

Examples

The following code examples provide input for the ItemMetadataSchema object. The constants in the sample code define an integer value for each column in the item store. These values are used when creating the custom field definitions and identity rules for the ItemMetadataSchema object. To view this code in the context of a complete application, see the "Sync101 using Simple Sync Provider" application that is available in the Sync Framework SDK and from 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

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.Synchronization.SimpleProviders Namespace