ISqlSyncMetadataStore Interface

Represents a metadata store that uses a lightweight database for storage.


interface ISqlSyncMetadataStore : ISyncMetadataStore2


ISqlSyncMetadataStore methods



Creates a metadata store file and a metadata store object to represent it.


Opens an existing metadata store file and returns a metadata store object that represents it.


Releases the resources that are used by the ISqlSyncMetadataStore object.


The metadata storage service offers a complete implementation of the metadata storage service API that uses a lightweight database to store all the metadata that is required for synchronization in one database file in a specified location in the file system. The entry point into this implementation is ISqlSyncMetadataStore. To obtain an object that implements this interface, pass CLSID_SyncMetadataStore and IID_ISqlSyncMetadataStore to the CoCreateInstance function.

To use the implementation of the metadata storage service API

  1. Create a new metadata store by using ISqlSyncMetadataStore::CreateStore, or open an existing metadata store by using ISqlSyncMetadataStore::OpenStore.

  2. Create metadata for a specified replica by using ISyncMetadataStore::InitializeReplicaMetadata, or open existing replica metadata by using ISyncMetadataStore::GetReplicaMetadata. GetReplicaMetadata return an implementation of IReplicaMetadata that can access replica metadata that is stored in the metadata store.

  3. Begin a database transaction by using ISyncMetadataStore::BeginTransaction. This helps guarantee that, for changes made to the metadata after this method is called, either all are saved to the database or none are saved.

  4. Create new item metadata by using IReplicaMetadata::CreateNewItemMetadata or find metadata for individual items by using methods such as IReplicaMetadata::FindItemMetadataByGlobalId. These methods return an implementation of IItemMetadata that can access item metadata that is stored in the metadata store.

  5. Make changes to the item metadata and save those changes by using IReplicaMetadata::SaveItemMetadata.

  6. Commit the changes to the metadata store by calling ISyncMetadataStore::CommitTransaction, or discard the changes by calling ISyncMetadataStore::RollbackTransaction.

This implementation of the API also provides methods on the IReplicaMetadata object that help detect items deleted from the item store. For example, IReplicaMetadata::GetUnreportedItems returns a list of items that exist in the metadata store but do not exist in the item store. A provider can then mark the items in this list as tombstones in the metadata store.


Header: Metastore.h

See Also


Sync Framework Metadata Storage Service Components

Getting Started Storing Metadata