Interface IComponentManager

Interface to list components and component categories.

Namespace: EPiServer.Shell.ViewComposition
Assembly: EPiServer.Shell.dll
Version: 8.11.0
Syntax
public interface IComponentManager

Methods

CreateComponent(IComponentDefinition, IPrincipal)

Creates a component from the component definition.

Declaration
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.

Remarks

Will perform access control validation for the component definition and throw a System.UnauthorizedAccessException if the user does not have access to the component definition.

CreateComponent(String, IPrincipal)

Creates a component from a component definition name.

Declaration
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

Remarks

If no component definition exists with the given name null will be returned. Will perform access control validation for the component definition and throw a System.UnauthorizedAccessException if the user does not have access to the component definition.

GetCategories(IPrincipal)

Gets a list of all categories for the components.

Declaration
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
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
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
IEnumerable<IComponentDefinition> ListAll()
Returns
Type Description
System.Collections.Generic.IEnumerable<IComponentDefinition>

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

Remarks

This method does not filter components for function access rights.