SqlSyncMetadataStoreSerializer::DeserializeReplicaMetadata Method
Deserializes the contents of a canonical metadata file to a metadata storage service store. Optionally upgrades the metadata store format when the provider version changes.
Assembly: Microsoft.Synchronization.MetadataStorage (in Microsoft.Synchronization.MetadataStorage.dll)
public: virtual bool DeserializeReplicaMetadata( String^ serializedFilePath, unsigned int expectedProviderCompatibilityVersion, IProviderUpgradeCallback^ providerUpgradeCallback ) override
Parameters
- serializedFilePath
- Type: System::String
The file that contains the serialized metadata for a particular replica.
- expectedProviderCompatibilityVersion
- Type: System::UInt32
The provider compatibility version that is expected to be included in the canonical metadata file. If the expected version does not match the actual version, deserialization either fails by design when providerUpgradeCallback is a nullptr, or providerUpgradeCallback methods are called when providerUpgradeCallback is not nullptr. For more information, see fb008b8f-a90b-4cbc-b718-7cb9c92a26ea Accessing Metadata from Components with Different Versions and b3ff82fb-f946-4b7f-8a32-655535cf5e92 Upgrading the Metadata Store Version .
- providerUpgradeCallback
- Type: Microsoft.Synchronization.MetadataStorage::IProviderUpgradeCallback
Callback methods that are called when the metadata store format must be upgraded because the provider version contained in the serialized metadata is not the same as expectedProviderCompatibilityVersion.
| Exception | Condition |
|---|---|
| ArgumentNullException | A required parameter is a nullptr. |
| ArgumentException | serializedFilePath is an empty string. |
| ExplicitTransactionRequiredException | A transaction is not available within which to deserialize metadata. |
| MetadataStoreProviderVersionMismatchException | The provider compatibility version specified for expectedProviderCompatibilityVersion does not match the version specified in the canonical metadata file and providerUpgradeCallback is a nullptr. |
| SyncInvalidOperationException | The metadata store is not open. |
Three conditions must be met before this method is called:
The metadata store must be opened. Open a store by calling OpenStore or CreateStore.
The replica for which data is deserialized must already have its metadata store initialized. To initialize a metadata store, call InitializeReplicaMetadata.
An active transaction must be available on the SqlMetadataStore object. Start a transaction by calling BeginTransaction.
Calling this method when any of these conditions is not met results in an exception.
This method can be used as part of the procedure to upgrade the metadata schema when the provider version changes. For more information, see Upgrading the Metadata Store Version.