This content is archived. See latest version here

Last updated: Mar 31 2014

This document provides an introduction to the initialization system in the EPiServer platform. The initialization feature is used both by EPiServer CMS and EPiServer Commerce, as well as third-party and customized modules used with EPiServer products. You can develop your own initialization module.

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 will execute the modules.
  • Handling of re-execution of initialization modules (by hooking into ASP.NET) in the occurence of exceptions during startup.
  • The namespace EPiServer.Framework.Initialization which resides in the assembly EPiServer.Framework.

Refer to the Initialization system section of the EPiServer Framework SDK for more detailed information.

Sample initialization module

Here is a sample initialization module which 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) { }
    }
}

See also

  • Initialization system section in the EPiServer CMS SDK.
  • Creating an initialization module section in the EPiServer CMS SDK.

Do you have feedback on this documentation? Send an email to documentation@episerver.com. For development-related questions and discussions, refer to our Forums on https://world.episerver.com/forum/