November Happy Hour will be moved to Thursday December 5th.

Class IContainerExtensions

Contains extension methods for IContainer.

Inheritance
System.Object
IContainerExtensions
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: 9.12.2
Syntax
public static class IContainerExtensions

Methods

AddComponentsRecursive(IContainer, String, IEnumerable<IPluggableComponentDefinition>, IPrincipal)

Tries to add the components to one of the containers in the given root container.

Declaration
public static void AddComponentsRecursive(this IContainer container, string viewName, IEnumerable<IPluggableComponentDefinition> pluggableComponents, IPrincipal principal)
Parameters
Type Name Description
IContainer container

The container.

System.String viewName

The name of the view.

System.Collections.Generic.IEnumerable<IPluggableComponentDefinition> pluggableComponents

The components.

System.Security.Principal.IPrincipal principal

The principal.

FindComponentById(IContainer, Guid)

Finds the component that matches the given id or null if no matching component exists.

Declaration
public static IComponent FindComponentById(this IContainer container, Guid id)
Parameters
Type Name Description
IContainer container

The container to search in.

System.Guid id

The id to match.

Returns
Type Description
IComponent

The component that matches the given id or null if no matching container exists.

FindComponentById(IContainer, Guid, ref IContainer)

Finds the component that matches the given id or null if no matching component exists.

Declaration
public static IComponent FindComponentById(this IContainer container, Guid id, ref IContainer personalizationContainer)
Parameters
Type Name Description
IContainer container

The container to search in.

System.Guid id

The id to match.

IContainer personalizationContainer

The personalization container.

Returns
Type Description
IComponent

The component that matches the given id or null if no matching container exists.

FindContainerByPlugInArea(IContainer, String)

Gets the first container in the container hierarchy that matches plug in path.

Declaration
public static IContainer FindContainerByPlugInArea(this IContainer container, string plugInArea)
Parameters
Type Name Description
IContainer container

The container.

System.String plugInArea

The plug in area.

Returns
Type Description
IContainer

The first container in the container hierarchy that matches plug in path.

GetComponentList(IContainer)

Gets a list with all widget types currently in the containers component structure.

Declaration
public static IEnumerable<string> GetComponentList(this IContainer container)
Parameters
Type Name Description
IContainer container

The container.

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

A list with all widget types currently in the containers component structure.

RemoveComponentsRecursive(IContainer, IEnumerable<IComponentMatcher>, Boolean)

Tries to remove any components in any of the containers in the given root container structure that matches the components plug-in path and type.

Declaration
public static void RemoveComponentsRecursive(this IContainer container, IEnumerable<IComponentMatcher> componentMatchers, bool notifyComponentOnRemoval)
Parameters
Type Name Description
IContainer container

The container.

System.Collections.Generic.IEnumerable<IComponentMatcher> componentMatchers

The component matchers.

System.Boolean notifyComponentOnRemoval

if set to true any component that implement IComponentNotify are notified when removed.

ReplaceContainersRecursive(IContainer, IEnumerable<IContainer>, IComponentManager)

Replaces all containers in the container tree with any container in the replacementContainer list that matches the plug-in path.

Declaration
public static void ReplaceContainersRecursive(this IContainer container, IEnumerable<IContainer> replacementContainers, IComponentManager componentManager)
Parameters
Type Name Description
IContainer container

The container to alter.

System.Collections.Generic.IEnumerable<IContainer> replacementContainers

The replacement containers.

IComponentManager componentManager

The component manager suppling components from component definitions.

Remarks

This method will never replace the root container, only children in the container tree.