Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsGitHubNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Initialization system

Describes the initialization system used by Optimizely Content Management System (CMS) and Optimizely Commerce Connect and third-party and customized modules that are used with Optimizely products.

You can develop your initialization module, see Initialization.

The initialization system consists of the following:

  • A discovery mechanism to determine which modules should be part of the initialization process.
  • A dependency sorting algorithm that decides the order of execution.
  • An execution engine that executes the modules.
  • Handling of re-execution of initialization modules (by hooking into ASP.NET) in the occurrence of exceptions during startup.
  • The EPiServer.Framework.Initialization namespace, which resides in the assembly EPiServer.Framework.

Sample initialization module

The following sample initialization module takes a dependency on the EPiServer.Commerce.Initialization.InitializationModule and registers catalog content routes.

using System.Web.Routing;
using EPiServer.Framework;
using EPiServer.Commerce.Routing;
using EPiServer.Framework.Initialization;

namespace CodeSamples.EPiServer.Commerce.Catalog
  {
    [ModuleDependency(typeof(global::EPiServer.Commerce.Initialization.InitializationModule))]
    public class RegisterRoutingModuleSample : IInitializableModule
      {
        public void Initialize(InitializationEngine context)
          {
            MapRoutes(RouteTable.Routes);
          }
        private static void MapRoutes(RouteCollection routes)
          {
            CatalogRouteHelper.MapDefaultHierarchialRouter(routes, true);
          }
        public void Uninitialize(InitializationEngine context) { /*uninitialize*/}
        public void Preload(string[] parameters) { }
      }
  }