SqlMetadataStore Class

Represents a metadata store that is implemented by using a lightweight database to store the metadata.

Namespace: Microsoft.Synchronization.MetadataStorage
Assembly: Microsoft.Synchronization.MetadataStorage (in microsoft.synchronization.metadatastorage.dll)

Syntax

'Declaration
Public Class SqlMetadataStore
    Inherits MetadataStore
    Implements IDisposable
'Usage
Dim instance As SqlMetadataStore
public class SqlMetadataStore : MetadataStore, IDisposable
public ref class SqlMetadataStore : public MetadataStore, IDisposable
public class SqlMetadataStore extends MetadataStore implements IDisposable
public class SqlMetadataStore extends MetadataStore implements IDisposable

Remarks

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 SqlMetadataStore.

To use the Sync Framework implementation of the metadata storage service API

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

  2. Create metadata for a specified replica by using InitializeReplicaMetadata, or open existing replica metadata by using GetReplicaMetadata. Both methods return an implementation of ReplicaMetadata that can access replica metadata that is stored in the Sync Framework metadata store.

  3. Begin a database transaction by using BeginTransaction. This helps ensure 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 ReplicaMetadata.CreateItemMetadata or find metadata for individual items by using methods such as ReplicaMetadata.FindItemMetadataById. These methods return an implementation of ItemMetadata that can access item metadata that is stored in the Sync Framework metadata store.

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

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

This implementation of the API also provides a DeleteDetector object to help detect items deleted from the item store. This object is available through the ReplicaMetadata.DeleteDetector property.

Inheritance Hierarchy

System.Object
   Microsoft.Synchronization.MetadataStorage.MetadataStore
    Microsoft.Synchronization.MetadataStorage.SqlMetadataStore

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

SqlMetadataStore Members
Microsoft.Synchronization.MetadataStorage Namespace

Other Resources

Getting Started Storing Metadata