Class CompositeMessageUpgradeStrategy
Composite message upgrade strategy that delegates to multiple underlying strategies.
public sealed class CompositeMessageUpgradeStrategy : IMessageUpgradeStrategy
- Inheritance
-
CompositeMessageUpgradeStrategy
- Implements
- Inherited Members
- Extension Methods
Constructors
CompositeMessageUpgradeStrategy(IEnumerable<IMessageUpgradeStrategy>)
Initializes a new instance of the CompositeMessageUpgradeStrategy class.
public CompositeMessageUpgradeStrategy(IEnumerable<IMessageUpgradeStrategy> strategies)
Parameters
strategiesIEnumerable<IMessageUpgradeStrategy>The collection of upgrade strategies to use.
Methods
CanUpgrade(Type, string)
Determines whether any of the underlying strategies can upgrade the specified message type and version.
public bool CanUpgrade(Type messageType, string version)
Parameters
Returns
- bool
True if any strategy can upgrade the message; otherwise, false.
Upgrade(string, Type, string, string)
Upgrades a message using the first available strategy that can handle the upgrade.
public object Upgrade(string payload, Type messageType, string fromVersion, string toVersion)
Parameters
payloadstringThe serialized message payload.
messageTypeTypeThe type of message to upgrade.
fromVersionstringThe current version of the message.
toVersionstringThe target version to upgrade to.
Returns
- object
The upgraded message object.
Exceptions
- NotSupportedException
Thrown when no strategy can handle the upgrade.