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

Navigation [hide] [expand]
ARCHIVED This content is retired and no longer maintained. See the latest version here.

This topic describes the initialization system used by Episerver CMS and Episerver Commerce, and third-party and customized modules used with Episerver products. You can develop your own initialization module. See also Initialization in the Episerver Framework SDK.

How it works

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 occurence 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 to the EPiServer.Commerce.Initialization.InitializationModule and registers catalog content routes.

C#
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) { }
    }
}

Related topics

Last updated: Oct 12, 2015