Class DisplayChannelServiceExtensions

Extends IDisplayChannelService with convenient methods

Inheritance
System.Object
DisplayChannelServiceExtensions
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.Web
Assembly: EPiServer.Cms.AspNet.dll
Version: 11.20.7
Syntax
public static class DisplayChannelServiceExtensions

Methods

RegisterDisplayMode(IDisplayChannelService, IDisplayMode)

Registers an System.Web.WebPages.IDisplayMode instance as an DisplayChannel.

Declaration
public static void RegisterDisplayMode(this IDisplayChannelService displayChannelService, IDisplayMode displayMode)
Parameters
Type Name Description
IDisplayChannelService displayChannelService

The service that is being extended

System.Web.WebPages.IDisplayMode displayMode

The display mode.

Examples
  The following example shows the registration of a simple channel for MVC that is active for mobile request.
        public void Initialize(EPiServer.Framework.Initialization.InitializationEngine context)
{
context.Locate.DisplayChannelService()
    .RegisterDisplayMode(new DefaultDisplayMode(RenderingTags.Mobile)
{
    ContextCondition = (r) => r.Request.Browser.IsMobileDevice
});
}

RegisterDisplayMode(IDisplayChannelService, IDisplayMode, Int32)

Registers an System.Web.WebPages.IDisplayMode instance as an DisplayChannel.

Declaration
public static void RegisterDisplayMode(this IDisplayChannelService displayChannelService, IDisplayMode displayMode, int index)
Parameters
Type Name Description
IDisplayChannelService displayChannelService

The service that is being extended

System.Web.WebPages.IDisplayMode displayMode

The display mode.

System.Int32 index

The index of where the instance is registered.

Examples
  The following example shows the registration of a simple channel for MVC that is active for mobile request.
        public void Initialize(EPiServer.Framework.Initialization.InitializationEngine context)
{
context.Locate.DisplayChannelService()
    .RegisterDisplayMode(new DefaultDisplayMode(RenderingTags.Mobile)
{
    ContextCondition = (r) => r.Request.Browser.IsMobileDevice
});
}