Table of Contents

Interface IProductDataRetriever<TProductIdentifier, TProductData>

Namespace
CMS.Commerce
Assembly
CMS.Commerce.dll

Defines a contract for retrieving product data for price calculations based on product identifiers.

This generic interface can be implemented for different product identifier and product data types. Its responsibilities include:

  • Building and executing queries against the database using product identifiers.
  • Mapping raw product data into strongly typed TProductData objects.
  • Returning results as a read-only dictionary keyed by TProductIdentifier.
public interface IProductDataRetriever<TProductIdentifier, TProductData> where TProductIdentifier : ProductIdentifier where TProductData : ProductData

Type Parameters

TProductIdentifier

The type representing the product identifier. This can be a simple ProductIdentifier for standalone products, or a derived type that also carries additional information, such as a variant identifier.

TProductData

The type representing the product data returned from the database. Must inherit from ProductData and typically contains pricing, availability, and localized content information for the product or its variant.

Extension Methods

Methods

Get(IEnumerable<TProductIdentifier>, string, CancellationToken)

Retrieves product data for the specified product identifiers.

Task<IReadOnlyDictionary<TProductIdentifier, TProductData>> Get(IEnumerable<TProductIdentifier> productIdentifiers, string languageName, CancellationToken cancellationToken = default)

Parameters

productIdentifiers IEnumerable<TProductIdentifier>

A collection of product identifiers to query.

languageName string

The content language in which the product data should be retrieved.

cancellationToken CancellationToken

A token that can be used to cancel the asynchronous operation.

Returns

Task<IReadOnlyDictionary<TProductIdentifier, TProductData>>

A read-only dictionary that maps each TProductIdentifier to its corresponding TProductData.