Most efficient way to retrieve prices for large amount of products

Vote:
 

What is the most efficient way to retrieve prices for large amount of VariationContent. I need to display some things fi there are any variations with a price for a user in a certain category of variations. 

I have tried different solutions using the Commerce interfaces and they all seem to create an SQL query for each of the products individually. This is highly inefficient. Is there any way to get the prices through the API with small amount of queries?

#81805
Feb 26, 2014 17:01
Vote:
 

Hi,

Please note that EPiServer Commerce 7.5 (Assuming you're using this version) provides two interfaces related to prices:

- IPriceService, provides access to IPriceValue, should be used for read-only tasks or updating all the prices of a catalog entry.

- IPriceDetailService, provides access to IPriceDetailValue, should be used for CRUD tasks for individual price.

For IPriceService, we provide GetCatalogEntryPrices(IEnumerable<CatalogKey>) to get prices of multiple products at one. The default implemetation (PriceServiceDatabase) call only one to database, which should be very efficient.


Regards.

/Q

 

#81813
Edited, Feb 27, 2014 2:39
Vote:
 

Hi, 

I noticed that it is the IcontentRepository.GetChildren<T>(); that makes an individual query for each product. Is it possible to retrieve the children in a more efficient way? Im surprised that the GetChildren method doesn't retrieve the products in a smart way.

#81834
Feb 27, 2014 12:11
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.