Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

Class ApplicationContext

Contains information about the current application context

Inheritance
System.Object
ApplicationContext
Implements
Namespace: EPiServer.Commerce
Assembly: EPiServer.Business.Commerce.dll
Version: 14.26.0
Syntax
public class ApplicationContext : Object, IApplicationContext

Constructors

ApplicationContext()

Exposed for easier mock in tests

Declaration
protected ApplicationContext()

ApplicationContext(ContentTypeModelRepository, MetaDataOptions, CatalogOptions)

Creates a new instance of ApplicationContext

Declaration
public ApplicationContext(ContentTypeModelRepository contentTypeModelRepository, MetaDataOptions metadataOptions, CatalogOptions catalogOptions)
Parameters
Type Name Description
EPiServer.DataAbstraction.ContentTypeModelRepository contentTypeModelRepository
MetaDataOptions metadataOptions
CatalogOptions catalogOptions

Properties

DisableVersionSync

Gets the value of the DisableVersionSync appSetting, indicating whether an update to Catalog content done outside the Content APIs will remove any version data (e.g. drafts, old published versions...) for the affected Content. Setting this to true can improve the speed of batch operations done through the lower-level API:s (like ICatalogSystem), e.g. the catalog import.

Declaration
public virtual bool DisableVersionSync { get; }
Property Value
Type Description
System.Boolean

true to delete all versions; false to update versions if content models are available.

HasContentModelTypes

Indicates whether the current application has the IContent model types for catalog content available. Considers the models available if there is at least one available which is decorated with the CatalogContentTypeAttribute.

Declaration
public virtual bool HasContentModelTypes { get; }
Property Value
Type Description
System.Boolean

Instance

Declaration
public static ApplicationContext Instance { get; }
Property Value
Type Description
ApplicationContext

SkipContentModelCheck

Gets the episerver:SkipCatalogContentModelCheck appSetting, indicating wheter the value returned by HasContentModelTypes should be ignored. Setting this to true means operations that require the content models for catalog content are considered safe even if there are no classes decorated with CatalogContentTypeAttribute. This is useful for sites that don't use typed models.

Declaration
public virtual bool SkipContentModelCheck { get; }
Property Value
Type Description
System.Boolean
Remarks

The appSetting should under no circumstances be used in applications that share a database with an application which HAS content type models, e.g. in the Commerce Manager application.

Implements