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.
Encapsulating Metadata for Replicas
Several methods in this class help implement synchronization provider methods, such as the following: ReplicaMetadata.GetChangeBatch can perform most of the work for the GetChangeBatch method of KnowledgeSyncProvider.
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.
Encapsulating Metadata for Items
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.
|ChangeUnitMetadata||Represents the metadata that is associated with a change unit contained in an item in the synchronization scope.|
|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.|
|ExplicitTransactionRequiredException||The exception that is thrown when a method is called that requires an explicit transaction to have been started on the metadata store.|
|FieldSchema||Contains schema information that defines a custom field of an item in the metadata store.|
|IndexSchema||Represents a single or multicolumn index that can be used to more efficiently find items that are in the metadata store.|
|ItemMetadata||When overridden, represents the metadata that is associated with an item in the synchronization scope.|
|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.|
|KeyUniquenessException||The exception that is thrown when an attempt is made to save an item that has an invalid or duplicate ID.|
|MetadataFieldNotFoundException||The exception that is thrown when the named custom field does not exist.|
|MetadataStorageEngineException||The exception that is thrown when an operation on the metadata storage engine fails.|
|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.|
|MetadataStoreException||The base class for all metadata storage exceptions.|
|MetadataStoreInvalidOperationException||The exception that is thrown when a method call is invalid for the current state of the object.|
|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.|
|MultipleReplicasInStoreException||The exception that is thrown when GetSingleReplicaMetadata is called and the metadata store contains metadata for more than one replica.|
|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.|
|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.|
|ReplicaMetadataInUseException||The exception that is thrown when an attempt is made to create more than one active ReplicaMetadata instance for a particular replica ID.|
|ReplicaMetadataNotFoundException||The exception that is thrown when no replica metadata exists in the metadata store for the specified replica ID.|
|SqlMetadataStore||Represents a metadata store that is implemented by using a lightweight database to store the metadata.|
|SqlSyncFieldValue||Represents the value of a custom field of an item.|
|SqlSyncMetadataStoreSerializer||Serializes and deserializes metadata for a replica between a canonical metadata file format and version-specific metadata storage service store formats.|
|SyncFieldValue||When overridden in a derived class, represents the value of a custom field of an item.|
|SyncMetadataStoreSerializer||When overridden by a derived class, serializes and deserializes metadata for a replica.|
|UpgradeStartEventArgs||Provides data for the MetadataStoreUpgradeStart event.|
|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.|
|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.|