Table of Contents

Class PromotionInfoExtensions

Namespace
CMS.Commerce
Assembly
CMS.Commerce.dll

Extension methods for PromotionInfo.

public static class PromotionInfoExtensions
Inheritance
object
PromotionInfoExtensions

Methods

GetPromotionRuleProperties<TPromotionRuleProperties>(PromotionInfo)

Gets the promotion rule properties by deserializing the stored JSON properties from the promotion info.

public static TPromotionRuleProperties GetPromotionRuleProperties<TPromotionRuleProperties>(this PromotionInfo promotionInfo) where TPromotionRuleProperties : IPromotionRuleProperties

Parameters

promotionInfo PromotionInfo

The promotion info instance.

Returns

TPromotionRuleProperties

The deserialized promotion rule properties of type TPromotionRuleProperties, or null if the configuration is not available or cannot be deserialized.

Type Parameters

TPromotionRuleProperties

The type of the promotion rule properties to deserialize, which must implement IPromotionRuleProperties.

Exceptions

ArgumentNullException

Thrown when promotionInfo is null.

SetPromotionRuleProperties<TPromotionRuleProperties>(PromotionInfo, TPromotionRuleProperties)

Sets the promotion rule properties by serializing the configuration object to JSON and storing it.

public static void SetPromotionRuleProperties<TPromotionRuleProperties>(this PromotionInfo promotionInfo, TPromotionRuleProperties properties) where TPromotionRuleProperties : IPromotionRuleProperties

Parameters

promotionInfo PromotionInfo

The promotion info instance.

properties TPromotionRuleProperties

The promotion rule properties object to serialize and store.

Type Parameters

TPromotionRuleProperties

The type of the promotion rule properties, which must implement IPromotionRuleProperties.

Exceptions

ArgumentNullException

Thrown when promotionInfo or properties is null.