Consider the following scenario:
In this scenario, catalog caching may not be used to retrieve the child categories and child products. Therefore, the website may experience decreased performance when there is high load.
For example, you have a website that uses the AdventureWorks sample catalog. You run the following code example to retrieve the display name of a Category object. In this example, the code queries data from the Catalog database every time, although catalog caching is enabled.Note This same problem occurs when you use the GetProduct method in the code example.
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure. However, they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
- You enable caching in the catalog system in the Web.config file for a website that is running Microsoft Commerce Server 2009.
- You use the CategoryConfiguration class to specify the preloaded configuration of a Category object.
- You set the LoadChildProducts property to True.
- You specify a filtering clause in the CategoryConfiguration.ChildProducts.SqlWhereClause property.
- You use the GetCategory method or the GetProduct method to retrieve child categories or child products of the CategoryConfiguration object.
In this scenario, catalog caching may not be used to retrieve the child categories and child products. Therefore, the website may experience decreased performance when there is high load.
For example, you have a website that uses the AdventureWorks sample catalog. You run the following code example to retrieve the display name of a Category object. In this example, the code queries data from the Catalog database every time, although catalog caching is enabled.
CategoryConfiguration categoryConfiguration = new CategoryConfiguration();
categoryConfiguration.LoadChildProducts = true;
categoryConfiguration.ChildProducts.SqlWhereClause = "[IsVisible] = 1";
var catalogContext = CommerceContext.Current.CatalogSystem.CatalogContext;
Category category = catalogContext.GetCategory("AdventureWorks Catalog", "SleepingBags");
Response.Write(category.DisplayName);
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure. However, they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.