SaaS CMS has officially launched! Learn more now.

Class ComponentManager

Implements functionality for managing and creating components from component providers.

Inheritance
System.Object
ComponentManager
Implements
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.Shell.ViewComposition
Assembly: EPiServer.Shell.dll
Version: 8.11.0
Syntax
[ServiceConfiguration(typeof(IComponentManager), Lifecycle = ServiceInstanceScope.Singleton)]
public class ComponentManager : IComponentManager

Constructors

ComponentManager(IEnumerable<IComponentProvider>)

Initializes a new instance of the ComponentManager class.

Declaration
public ComponentManager(IEnumerable<IComponentProvider> componentProviders)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<IComponentProvider> componentProviders

The component providers.

ComponentManager(IEnumerable<IComponentProvider>, EPiServerShellSection)

Initializes a new instance of the ComponentManager class.

Declaration
public ComponentManager(IEnumerable<IComponentProvider> componentProviders, EPiServerShellSection shellSection)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<IComponentProvider> componentProviders

The component providers.

EPiServerShellSection shellSection

The shell section containing configuration settings for components.

Methods

CreateComponent(IComponentDefinition, IPrincipal)

Validates that the user has access to the component definition and creates a component from it.

Declaration
public IComponent CreateComponent(IComponentDefinition definition, IPrincipal principal)
Parameters
Type Name Description
IComponentDefinition definition

The definition to create a component for.

System.Security.Principal.IPrincipal principal

The principal.

Returns
Type Description
IComponent

A component instance.

CreateComponent(String, IPrincipal)

Creates a component from a component definition name.

Declaration
public IComponent CreateComponent(string componentDefinitionName, IPrincipal principal)
Parameters
Type Name Description
System.String componentDefinitionName

Name of the component definition.

System.Security.Principal.IPrincipal principal

The principal.

Returns
Type Description
IComponent

A IComponent instance

GetCategories(IPrincipal)

Gets a list of all categories for the components.

Declaration
public IEnumerable<string> GetCategories(IPrincipal principal)
Parameters
Type Name Description
System.Security.Principal.IPrincipal principal

The principal.

Returns
Type Description
System.Collections.Generic.IEnumerable<System.String>

GetComponentDefinition(String)

Gets a component defintion by its name.

Declaration
public IComponentDefinition GetComponentDefinition(string name)
Parameters
Type Name Description
System.String name

The name of the definition to get.

Returns
Type Description
IComponentDefinition

The component definition having the supplied name, or null if none was found.

List(IPrincipal, String, Boolean)

Lists all registrered components that matches the given criteria.

Declaration
public IEnumerable<IComponentDefinition> List(IPrincipal principal, string category, bool onlyShowComponentsAvailableForUserSelection)
Parameters
Type Name Description
System.Security.Principal.IPrincipal principal

The principal.

System.String category

The category to match.

System.Boolean onlyShowComponentsAvailableForUserSelection

if set to true only shows components that has IsAvailableForUserSelection set to true.

Returns
Type Description
System.Collections.Generic.IEnumerable<IComponentDefinition>

An System.Collections.Generic.IEnumerable<T> containing all components that matches the given criteria.

ListAll()

Lists all registrered components.

Declaration
public IEnumerable<IComponentDefinition> ListAll()
Returns
Type Description
System.Collections.Generic.IEnumerable<IComponentDefinition>

An System.Collections.Generic.IEnumerable<T> containing all components.

Implements