Class InitializationEngine

Used internally by EPiServer to initialize a set of modules

Inheritance
System.Object
InitializationEngine
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Framework.Initialization
Assembly: EPiServer.Framework.dll
Version: 8.11.0
Syntax
public class InitializationEngine

Constructors

InitializationEngine()

Declaration
public InitializationEngine()

InitializationEngine(IEnumerable<IInitializableModule>, HostType)

Constructor used for testing and outside-the-web purposes.

Declaration
public InitializationEngine(IEnumerable<IInitializableModule> modules, HostType hostType)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<IInitializableModule> modules

The list of modules to initialize using this engine.

HostType hostType

The type of host this engine initializes.

InitializationEngine(IEnumerable<IInitializableModule>, HostType, IEnumerable<Assembly>)

Constructor used for testing and outside-the-web purposes.

Declaration
public InitializationEngine(IEnumerable<IInitializableModule> modules, HostType hostType, IEnumerable<Assembly> assemblies)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<IInitializableModule> modules

The list of modules to initialize using this engine.

HostType hostType

The type of host this engine initializes.

System.Collections.Generic.IEnumerable<System.Reflection.Assembly> assemblies

A list of assemblies that can be scanned as part of initialization

Properties

Assemblies

A list of assemblies that should participate in the initialization

Declaration
public IEnumerable<Assembly> Assemblies { get; set; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<System.Reflection.Assembly>
Remarks

This list will be the base for different scanning operations done within the initialization such as plug-in systems and services configured using ServiceConfigurationAttribute, it is also used if ScanAssemblies() is called to automatically populate the list of assemblies.

By default when EPiServer initializes this will be set to a list of allowed assemblies configured in Assemblies

HostType

The HostType of the current application

Declaration
public HostType HostType { get; }
Property Value
Type Description
HostType

InitializationState

Gets or sets the state of the initialization.

Declaration
public InitializationState InitializationState { get; protected set; }
Property Value
Type Description
InitializationState

The state of the initialization.

Locate

Gets the object used to resolve services part of the public API.

Declaration
public ServiceLocationHelper Locate { get; }
Property Value
Type Description
ServiceLocationHelper

Modules

The list of modules that should be initialized

Declaration
public IEnumerable<IInitializableModule> Modules { get; set; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<IInitializableModule>
Remarks

You can automatically populate this list by calling ScanAssemblies()

Methods

ConfigureContainer(HostType)

Does a first pass to configure the IoC container so services are configured before we initialize

Declaration
protected void ConfigureContainer(HostType hostType)
Parameters
Type Name Description
HostType hostType

Type of the host.

GetDependencySortedModules()

Gets the list of initialization modules sorted by dependencies.

Declaration
public IList<IInitializableModule> GetDependencySortedModules()
Returns
Type Description
System.Collections.Generic.IList<IInitializableModule>

A list of IInitializableModule.

Initialize(HostType)

Initializes all initializable modules.

Declaration
public void Initialize(HostType hostType)
Parameters
Type Name Description
HostType hostType

InitializeModules()

Initializes the modules.

Declaration
protected void InitializeModules()

IsInitialized(IInitializableModule)

Determines whether the specified module is initialized.

Declaration
public bool IsInitialized(IInitializableModule module)
Parameters
Type Name Description
IInitializableModule module

The module.

Returns
Type Description
System.Boolean

true if the specified module is initialized; otherwise, false.

OnInitComplete()

Called when initialization is complete to raise the InitComplete event.

Declaration
public void OnInitComplete()
Remarks

The invocation of the InitComplete event is a bit special. In order to support the same kind of "retry on exception" semantics as for the Initialize(InitializationEngine) method, we simply remove the delegate from the event handler once it has executed successfully (i.e. without throwing an exception).

ScanAssemblies()

Scans the list of assemblies for initialization modules

Declaration
public void ScanAssemblies()

Uninitialize()

Un-initialize all initializable modules.

Declaration
public void Uninitialize()

Events

InitComplete

InitComplete is raised when initialization is complete.

Declaration
public event EventHandler InitComplete
Event Type
Type Description
System.EventHandler
Remarks

Initialization is complete when all intializable modules have executed successfully (without throwing any exception).