SqlMetadataStore Class

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

Inheritance Hierarchy

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

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
type SqlMetadataStore =  
    class
        inherit MetadataStore
        interface IDisposable
    end
public class SqlMetadataStore extends MetadataStore implements IDisposable

The SqlMetadataStore type exposes the following members.

Methods

  Name Description
Public method BeginTransaction() Starts an explicit transaction on the metadata store that has an isolation level of ReadCommitted.
Public method BeginTransaction(IsolationLevel) Starts an explicit transaction on the metadata store that has the specified isolation level. (Overrides MetadataStore.BeginTransaction(IsolationLevel).)
Public method CommitTransaction Commits an explicit transaction that has already started on the metadata store. (Overrides MetadataStore.CommitTransaction().)
Public methodStatic member CreateStore(String) Creates a metadata store file that has the specified name and location, and returns a metadata store object that represents it.
Public methodStatic member CreateStore(String, CultureInfo) Creates a metadata store file that has the specified name, location, and locale; and returns a metadata store object that represents it.
Public method Dispose Releases the resources that are used by SqlMetadataStore.
Public method Equals (Inherited from Object.)
Protected method Finalize Finalizer for SqlMetadataStore. (Overrides Object.Finalize().)
Public method GetHashCode (Inherited from Object.)
Public method GetMetadataStoreSerializer Gets an object that serializes and deserializes the metadata store to and from the canonical format.
Public method GetReplicaMetadata Gets a replica metadata object that is used to access replica metadata in the metadata store. (Overrides MetadataStore.GetReplicaMetadata(SyncIdFormatGroup, SyncId).)
Public method GetSingleReplicaMetadata Gets the metadata for the single replica contained in the metadata store. (Overrides MetadataStore.GetSingleReplicaMetadata().)
Public method GetType (Inherited from Object.)
Public method InitializeReplicaMetadata Creates and initializes metadata for a replica in the metadata store, and returns a replica metadata object that is used to access the replica metadata. (Overrides MetadataStore.InitializeReplicaMetadata(SyncIdFormatGroup, SyncId, IEnumerable<FieldSchema>, IEnumerable<IndexSchema>).)
Public method IsTransactionActive Indicates whether an active transaction exists on the metadata store. (Overrides MetadataStore.IsTransactionActive(IsolationLevel%).)
Protected method MemberwiseClone (Inherited from Object.)
Public methodStatic member OpenStore(String) Opens an existing metadata store file that has the specified name and location, and returns a metadata store object that represents it.
Public methodStatic member OpenStore(String, CultureInfo) Opens an existing metadata store file that has the specified name, location, and locale; and returns a metadata store object that represents it.
Public method RemoveReplicaMetadata Removes all metadata associated with the specified replica. (Overrides MetadataStore.RemoveReplicaMetadata(SyncIdFormatGroup, SyncId).)
Public method RollbackTransaction Cancels the current explicit transaction and rolls the metadata store back to the state it was in before the transaction was started. (Overrides MetadataStore.RollbackTransaction().)
Public method ToString (Inherited from Object.)

Top

Events

  Name Description
Public eventStatic member MetadataStoreUpgradeStart Occurs when the metadata store file format is about to be upgraded.
Public eventStatic member MetadataStoreUpgradeStop Occurs when the metadata store file format upgrade has finished.

Top

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.

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

Microsoft.Synchronization.MetadataStorage Namespace

Other Resources

Getting Started Storing Metadata