Try our conversational search powered by Generative AI!

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: 11.20.7
Syntax
public class InitializationEngine : IInitializationEngine

Constructors

InitializationEngine()

Declaration
public InitializationEngine()

InitializationEngine(IServiceLocatorFactory)

Constructor used when service locator and service configuration provider is created from passed in factory

Declaration
public InitializationEngine(IServiceLocatorFactory serviceLocatorFactory)
Parameters
Type Name Description
IServiceLocatorFactory serviceLocatorFactory

The factory used to create service configuration provider and locator

Remarks

Will initialize the application as WebApplication

InitializationEngine(IServiceLocatorFactory, HostType)

Constructor used when service locator and service configuration provider is created from passed in factory

Declaration
public InitializationEngine(IServiceLocatorFactory serviceLocatorFactory, HostType hostType)
Parameters
Type Name Description
IServiceLocatorFactory serviceLocatorFactory

The factory used to create service configuration provider and locator

HostType hostType

Specifies which hosttype the application should be initialized as

InitializationEngine(IServiceLocatorFactory, HostType, IEnumerable<Assembly>)

Constructor used when service locator and service configuration provider is created from passed in factory and scanning is done from explicit specified assemblies

Declaration
public InitializationEngine(IServiceLocatorFactory serviceLocatorFactory, HostType hostType, IEnumerable<Assembly> assemblies)
Parameters
Type Name Description
IServiceLocatorFactory serviceLocatorFactory

The factory used to create service configuration provider and locator

HostType hostType

Specifies which hosttype the application should be initialized as

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

The assemblies to scan

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

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Constructor used for testing and outside-the-web purposes, not intended for public use

Declaration
public InitializationEngine(IServiceLocatorFactory serviceLocatorFactory, IEnumerable<IInitializableModule> modules, HostType hostType, IEnumerable<Assembly> assemblies, IAssemblyScanner assemblyScanner)
Parameters
Type Name Description
IServiceLocatorFactory serviceLocatorFactory

The factory used to create service configuration provider and locator

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

IAssemblyScanner assemblyScanner

The assembly scanner

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

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

Modules

The list of modules that should be initialized

Declaration
public virtual 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

BuildTypeScanner()

Builds a ITypeScannerLookup from configured assemblies and modules

Declaration
public virtual ITypeScannerLookup BuildTypeScanner()
Returns
Type Description
ITypeScannerLookup

A type scanner lookup

Configure()

Calls all IConfigurableModule instances.

Declaration
public void Configure()

ConfigureModules(IEnumerable<IInitializableModule>)

Calls all IConfigurableModule instances.

Declaration
public virtual void ConfigureModules(IEnumerable<IInitializableModule> modules)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<IInitializableModule> modules

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()

Initializes all initializable modules.

Declaration
public void Initialize()

Initialize(HostType)

Initializes all initializable modules.

Declaration
[Obsolete("Assign host type via constructor")]
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).

Implements

Extension Methods