Sdílet prostřednictvím


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
public abstract ReplicaMetadata InitializeReplicaMetadata (
    SyncIdFormatGroup idFormats, 
    SyncId replicaId, 
    IEnumerable<FieldSchema> customItemFieldSchemas, 
    IEnumerable<IndexSchema> customIndexedFieldSchemas
)
public abstract function InitializeReplicaMetadata (
    idFormats : SyncIdFormatGroup, 
    replicaId : SyncId, 
    customItemFieldSchemas : IEnumerable<FieldSchema>, 
    customIndexedFieldSchemas : IEnumerable<IndexSchema>
) : ReplicaMetadata

Parameters

  • idFormats
    The ID format schema for the provider.
  • replicaId
    The replica ID for the replica that is represented by the metadata that is being created and initialized.
  • customItemFieldSchemas
    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
    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

A ReplicaMetadata object that represents the newly created replica metadata.

Exceptions

Exception type 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 Microsoft.Synchronization.MetadataStorage.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
MetadataStore Members
Microsoft.Synchronization.MetadataStorage Namespace