Udostępnij za pośrednictwem


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.

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

Syntax

'Declaration
Public Overrides Function DeserializeReplicaMetadata ( _
    serializedFilePath As String, _
    expectedProviderCompatibilityVersion As UInteger, _
    providerUpgradeCallback As IProviderUpgradeCallback _
) As Boolean
'Usage
Dim instance As SqlSyncMetadataStoreSerializer
Dim serializedFilePath As String
Dim expectedProviderCompatibilityVersion As UInteger
Dim providerUpgradeCallback As IProviderUpgradeCallback
Dim returnValue As Boolean

returnValue = instance.DeserializeReplicaMetadata(serializedFilePath, expectedProviderCompatibilityVersion, providerUpgradeCallback)
public override bool DeserializeReplicaMetadata (
    string serializedFilePath,
    uint expectedProviderCompatibilityVersion,
    IProviderUpgradeCallback providerUpgradeCallback
)
public:
virtual bool DeserializeReplicaMetadata (
    String^ serializedFilePath, 
    unsigned int expectedProviderCompatibilityVersion, 
    IProviderUpgradeCallback^ providerUpgradeCallback
) override
public boolean DeserializeReplicaMetadata (
    String serializedFilePath, 
    UInt32 expectedProviderCompatibilityVersion, 
    IProviderUpgradeCallback providerUpgradeCallback
)
public override function DeserializeReplicaMetadata (
    serializedFilePath : String, 
    expectedProviderCompatibilityVersion : uint, 
    providerUpgradeCallback : IProviderUpgradeCallback
) : boolean

Parameters

  • serializedFilePath
    The file that contains the serialized metadata for a particular replica.
  • expectedProviderCompatibilityVersion
    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 null reference (Nothing in Visual Basic), or providerUpgradeCallback methods are called when providerUpgradeCallback is not null reference (Nothing in Visual Basic). For more information, see Accessing Metadata from Components with Different Versions and Upgrading the Metadata Store Version.
  • providerUpgradeCallback
    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.

Return Value

true when there is metadata to deserialize; otherwise, false.

Exceptions

Exception type Condition

ArgumentNullException

A required parameter is a null reference (Nothing in Visual Basic).

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 null reference (Nothing in Visual Basic).

SyncInvalidOperationException

The metadata store is not open.

Remarks

Three conditions must be met before this method is called:

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.

See Also

Reference

SqlSyncMetadataStoreSerializer Class
SqlSyncMetadataStoreSerializer Members
Microsoft.Synchronization.MetadataStorage Namespace