Sdílet prostřednictvím


Microsoft.Synchronization.MetadataStorage Namespace

The metadata storage service provides support for storing and handling synchronization metadata.

The metadata storage service e defines many of its classes as abstract so that storage service writers can implement a custom set of classes to store metadata in any kind of data store.

The metadata storage service also provides an implementation of the classes that use a lightweight database to store synchronization metadata in a single database file in a file system.

The main class for all metadata stores is MetadataStore. This abstract base class contains methods to initialize and get replica metadata in the metadata store, and to start and stop transactions on the database. Classes that override this base class will likely provide methods to create and open metadata stores, such as SqlMetadataStore. This class contains methods to create and open a metadata store.

Replica metadata is initialized in the metadata store by using InitializeReplicaMetadata. The FieldSchema parameter to this method enables a set of custom fields to be created. These fields can be used to store additional metadata for items in the metadata store. The IndexSchema parameter enables sets of fields to be defined as indexes. These can be used to efficiently locate items in the metadata store.

The ReplicaMetadata class encapsulates all the metadata for a particular replica. Replica metadata can be accessed by using members like GetKnowledge and ReplicaId:

ReplicaMetadata also contains DeleteDetector. A provider can use the object contained in this property to detect which items have been deleted from the item store and should be marked as deleted in the metadata store.

Item metadata can be found in the metadata store by using ReplicaMetadata methods to search by item ID or indexed fields, such as FindItemMetadataById or FindItemMetadataByIndexedFields. The ItemMetadata class encapsulates all the metadata for a particular item. This class contains standard synchronization metadata, such as ChangeVersion, CreationVersion, GlobalId, and IsDeleted. This class also contains several methods that can be used to access any custom fields that were defined when the replica metadata was initialized.

Classes

  Class Description
Public class ChangeUnitMetadata Represents the metadata that is associated with a change unit contained in an item in the synchronization scope.
Public class DeleteDetector When implemented by a derived class, DeleteDetector determines which items were deleted from a replica. These items must be marked as deleted in the metadata store.
Public class ExplicitTransactionRequiredException The exception that is thrown when a method is called that requires an explicit transaction to have been started on the metadata store.
Public class FieldSchema Contains schema information that defines a custom field of an item in the metadata store.
Public class IndexSchema Represents a single or multicolumn index that can be used to more efficiently find items that are in the metadata store.
Public class ItemMetadata When overridden, represents the metadata that is associated with an item in the synchronization scope.
Public class ItemMetadataNotFoundException The exception that is thrown when an item that has the specified ID or custom field value could not be found in the metadata store.
Public class KeyUniquenessException The exception that is thrown when an attempt is made to save an item that has an invalid or duplicate ID.
Public class MetadataFieldNotFoundException The exception that is thrown when the named custom field does not exist.
Public class MetadataStorageEngineException The exception that is thrown when an operation on the metadata storage engine fails.
Public class MetadataStore When overridden, represents a metadata store and provides methods to obtain a replica metadata object. The replica metadata object is used to access the metadata for a specific replica. This is the abstract base class for all metadata stores that use the metadata storage service API.
Public class MetadataStoreException The base class for all metadata storage exceptions.
Public class MetadataStoreInvalidOperationException The exception that is thrown when a method call is invalid for the current state of the object.
Public class MetadataStoreProviderVersionMismatchException The exception that is thrown when DeserializeReplicaMetadata is called and the specified expected provider compatibility version does not match the provider version stored in the serialized metadata.
Public class MultipleReplicasInStoreException The exception that is thrown when GetSingleReplicaMetadata is called and the metadata store contains metadata for more than one replica.
Public class ReplicaMetadata When overridden, provides access to the replica metadata and item metadata in the metadata store. ReplicaMetadata also provides services for delete detection and helpers for implementing synchronization provider methods.
Public class ReplicaMetadataAlreadyExistsException The exception that is thrown when an attempt is made to create new replica metadata in a metadata store when metadata for that replica already exists in the metadata store.
Public class ReplicaMetadataInUseException The exception that is thrown when an attempt is made to create more than one active ReplicaMetadata instance for a particular replica ID.
Public class ReplicaMetadataNotFoundException The exception that is thrown when no replica metadata exists in the metadata store for the specified replica ID.
Public class SqlMetadataStore Represents a metadata store that is implemented by using a lightweight database to store the metadata.
Public class SqlSyncFieldValue Represents the value of a custom field of an item.
Public class SqlSyncMetadataStoreSerializer Serializes and deserializes metadata for a replica between a canonical metadata file format and version-specific metadata storage service store formats.
Public class SyncFieldValue When overridden in a derived class, represents the value of a custom field of an item.
Public class SyncMetadataStoreSerializer When overridden by a derived class, serializes and deserializes metadata for a replica.
Public class UpgradeStartEventArgs Provides data for the MetadataStoreUpgradeStart event.
Public class VersionNotSupportedException The exception that is thrown when an attempt is made to get replica metadata from a metadata store, but the version of the metadata is not supported by the implementation of the metadata store.

Interfaces

  Interface Description
Public interface IProviderUpgradeCallback When implemented by a derived class, represents methods that Sync Framework can call to notify a provider about events that occur during a metadata store upgrade that is initiated because the provider version has changed.

Delegates

  Delegate Description
Public delegate ReplicaMetadata.ItemFilterCallback Represents the method that will determine whether an item change should be included in a change batch.