Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Magnus Rahl
Mar 9, 2015
  5748
(3 votes)

Optional performance tweaks in EPiServer Commerce 8.9

EPiServer Commerce 8.9 contains, among many other features and fixes, several performance improvements with focus on Orders and the Catalog. These performance improvements benefit all implementations automatically. But we have also added a couple of optional tweaks.

Disabling version sync for ICatalogSystem operations

Whenever a catalog entry, node or the catalog itself is updated using ICatalogSystem (CatalogContext.Current) a synchronization mechanism activates to make sure that the content versions used by the Content Repository and the Catalog UI are up to date with the change. This includes updates done through the catalog import, Service API and integrations using any of these.

This version synchronization can now be disabled if you don’t care about the versions, e.g. if the catalog information is maintained using an external system that integrates using ICatalogSystem. Note that “disabled” in this context means that rather than updating or creating versions, any existing versions (including drafts not yet published) will be removed when the corresponding data is updated through ICatalogSystem.

The version synchronization is controlled by the AppSetting “DisableVersionSync”. It defaults to false if not present in the config file, i.e. version synchronization enabled. To disable synchronization, set it to true:

<appSettings>
  <add key="DisableVersionSync" value="true" />
</appSettings>

Clear version history for saved Catalog Content

The DisableVersionSync AppSetting does not affect updates done through the ContentRepository (including the Catalog UI), versions will be created regardless of the setting. But similar mechanism for skipping/clearing versions has been added to the ContentRepository. By extending the used SaveAction with the extra flag ExtendedSaveAction.ClearVersions in the call to Save(), any existing versions of the content will be removed. Note that this applies only to the Catalog Content Provider, other providers are unaware of this flag.

The best way to add the flag is to use the SetExtendedActionFlag extension method (namespace EPiServer.Commerce.Catalog.Provider), example:

// using EPiServer.Commerce.Catalog.Provider;
var contentRepository = ServiceLocator.Current.GetInstance<IContentRepository>();
var myContent = contentRepository.Get<MyProductContentType>(linkToProductContent);
myContent = (MyProductContentType)myContent.CreateWritableClone();
myContent.Name = "New name";
var publishAndClearAction = SaveAction.Publish.SetExtendedActionFlag(ExtendedSaveAction.ClearVersions);
contentRepository.Save(myContent, publishAndClearAction, AccessLevel.NoAccess);

This might be useful for example in cases where the catalog data is maintained in an external system and the integration uses the Content Repository to import the catalog data.

Mar 09, 2015

Comments

Rasmus Hollin
Rasmus Hollin Apr 9, 2015 08:33 AM

Is versions still created when updatning catalog entries (products, catalog nodes) manually in CMS?

Magnus Rahl
Magnus Rahl Apr 13, 2015 08:42 AM

Yes, if you work with the new Catalog UI versions will still be created, as they will if you work with the content repository and don't use the ExtendedSaveAction.ClearVersions.

May 7, 2015 11:18 AM

Is it possible to clear verisons for assets connected to catalog entries?

Magnus Rahl
Magnus Rahl May 18, 2015 10:37 AM

The assets are basically a feature of CMS and are not affected by any of these flags.

Rasmus Hollin
Rasmus Hollin Jun 17, 2015 07:19 AM

Is the app setting to be added to Web.config for CMS or Commerce site?

Magnus Rahl
Magnus Rahl Aug 12, 2015 11:25 AM

This is for the frontend site. Changed made through the Commerce Manager site will always clear versions (as it says in the warning above the form when editing catalog entities in CM).

Please login to comment.
Latest blogs
Solving the mystery of high memory usage

Sometimes, my work is easy, the problem could be resolved with one look (when I’m lucky enough to look at where it needs to be looked, just like th...

Quan Mai | Apr 22, 2024 | Syndicated blog

Search & Navigation reporting improvements

From version 16.1.0 there are some updates on the statistics pages: Add pagination to search phrase list Allows choosing a custom date range to get...

Phong | Apr 22, 2024

Optimizely and the never-ending story of the missing globe!

I've worked with Optimizely CMS for 14 years, and there are two things I'm obsessed with: Link validation and the globe that keeps disappearing on...

Tomas Hensrud Gulla | Apr 18, 2024 | Syndicated blog

Visitor Groups Usage Report For Optimizely CMS 12

This add-on offers detailed information on how visitor groups are used and how effective they are within Optimizely CMS. Editors can monitor and...

Adnan Zameer | Apr 18, 2024 | Syndicated blog