Class PromotionRuleBase<TPromotionRuleProperties, TPriceCalculationRequest, TPriceCalculationResult>
Abstract base class for a promotion rule definition.
public abstract class PromotionRuleBase<TPromotionRuleProperties, TPriceCalculationRequest, TPriceCalculationResult> : IPromotionRule<TPriceCalculationRequest, TPriceCalculationResult>, IPromotionRule where TPromotionRuleProperties : IPromotionRuleProperties, new() where TPriceCalculationRequest : IPriceCalculationRequest where TPriceCalculationResult : IPriceCalculationResult
Type Parameters
TPromotionRulePropertiesType containing promotion rule properties.
TPriceCalculationRequestType of the price calculation request.
TPriceCalculationResultType of the price calculation result.
- Inheritance
-
objectPromotionRuleBase<TPromotionRuleProperties, TPriceCalculationRequest, TPriceCalculationResult>
- Implements
-
IPromotionRule<TPriceCalculationRequest, TPriceCalculationResult>
- Derived
- Extension Methods
Constructors
PromotionRuleBase()
protected PromotionRuleBase()
Properties
Properties
Promotion rule properties.
public TPromotionRuleProperties Properties { get; }
Property Value
- TPromotionRuleProperties
Methods
IsApplicable(IPriceCalculationData<TPriceCalculationRequest, TPriceCalculationResult>, CancellationToken)
Determines whether the promotion is applicable for products in calculationData.
Method should be called after properties were initialized using ConfigurePromotionRuleProperties(PromotionInfo) method.
public virtual Task<bool> IsApplicable(IPriceCalculationData<TPriceCalculationRequest, TPriceCalculationResult> calculationData, CancellationToken cancellationToken)
Parameters
calculationDataIPriceCalculationData<TPriceCalculationRequest, TPriceCalculationResult>Price calculation data.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<bool>
Trueif the promotion is applicable for the specifiedcalculationData, otherwisefalse.