MetadataStore.InitializeReplicaMetadata Method

When overridden in a derived class, creates, initializes, and saves new metadata for a replica.

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

Syntax

'Declaration
Public MustOverride Function InitializeReplicaMetadata ( _
    idFormats As SyncIdFormatGroup, _
    replicaId As SyncId, _
    customItemFieldSchemas As IEnumerable(Of FieldSchema), _
    customIndexedFieldSchemas As IEnumerable(Of IndexSchema) _
) As ReplicaMetadata
'Usage
Dim instance As MetadataStore
Dim idFormats As SyncIdFormatGroup
Dim replicaId As SyncId
Dim customItemFieldSchemas As IEnumerable(Of FieldSchema)
Dim customIndexedFieldSchemas As IEnumerable(Of IndexSchema)
Dim returnValue As ReplicaMetadata

returnValue = instance.InitializeReplicaMetadata(idFormats, _
    replicaId, customItemFieldSchemas, _
    customIndexedFieldSchemas)
public abstract ReplicaMetadata InitializeReplicaMetadata(
    SyncIdFormatGroup idFormats,
    SyncId replicaId,
    IEnumerable<FieldSchema> customItemFieldSchemas,
    IEnumerable<IndexSchema> customIndexedFieldSchemas
)
public:
virtual ReplicaMetadata^ InitializeReplicaMetadata(
    SyncIdFormatGroup^ idFormats, 
    SyncId^ replicaId, 
    IEnumerable<FieldSchema^>^ customItemFieldSchemas, 
    IEnumerable<IndexSchema^>^ customIndexedFieldSchemas
) abstract
abstract InitializeReplicaMetadata : 
        idFormats:SyncIdFormatGroup * 
        replicaId:SyncId * 
        customItemFieldSchemas:IEnumerable<FieldSchema> * 
        customIndexedFieldSchemas:IEnumerable<IndexSchema> -> ReplicaMetadata 
public abstract function InitializeReplicaMetadata(
    idFormats : SyncIdFormatGroup, 
    replicaId : SyncId, 
    customItemFieldSchemas : IEnumerable<FieldSchema>, 
    customIndexedFieldSchemas : IEnumerable<IndexSchema>
) : ReplicaMetadata

Parameters

  • customItemFieldSchemas
    Type: System.Collections.Generic.IEnumerable<FieldSchema>
    The schema information that describes the custom metadata fields that are associated with the metadata items. Can be a null reference (Nothing in Visual Basic) if no custom metadata fields exist.
  • customIndexedFieldSchemas
    Type: System.Collections.Generic.IEnumerable<IndexSchema>
    The list of index schemas that can be used to more efficiently find items in the metadata store. Can be a null reference (Nothing in Visual Basic) if no index schemas exist.

Return Value

Type: Microsoft.Synchronization.MetadataStorage.ReplicaMetadata
A ReplicaMetadata object that represents the newly created replica metadata.

Exceptions

Exception Condition
SyncIdFormatMismatchException

The ID format schema that is specified by idFormats does not match the schema that is used to initialize the replica metadata.

Remarks

This method must perform all necessary tasks on the metadata store to create and initialize replica metadata so that the returned ReplicaMetadata object can be immediately used to access and modify the metadata.

A set of custom fields can be defined for item metadata by using customItemFieldSchemas. Each field consists of a unique string name and a value. These fields can be used to store any additional metadata about an item that is not otherwise supported by the default set of item metadata. The fields can be accessed by using various methods on ItemMetadata, such as ItemMetadata.GetByteField or ItemMetadata.SetCustomField.

A set of index schemas can be defined by using customIndexedFieldSchemas so that sets of custom fields can be used as indexes to efficiently find items in the metadata store. An index schema can be defined as unique to ensure that the index defines a single item. Each field that is contained in an index schema must also exist in the custom field schema that is defined for the replica. Index fields can be used in methods such as ReplicaMetadata.FindItemMetadataByIndexedField and ReplicaMetadata.FindItemMetadataByUniqueIndexedFields.

See Also

Reference

MetadataStore Class

Microsoft.Synchronization.MetadataStorage Namespace