Class HierarchicalCatalogPartialRouter
Partial router for catalog content, which handles hierarchical structure
Inheritance
Implements
Inherited Members
Namespace: EPiServer.Commerce.Routing
Assembly: EPiServer.Business.Commerce.dll
Version: 10.8.0Syntax
public class HierarchicalCatalogPartialRouter : ICommerceRouter, IPartialRouter<PageData, CatalogContentBase>
Constructors
HierarchicalCatalogPartialRouter(Func<ContentReference>, CatalogContentBase, Boolean)
Initialize a new instance of HierarchicalCatalogPartialRouter
Declaration
public HierarchicalCatalogPartialRouter(Func<ContentReference> routeStartingPoint, CatalogContentBase commerceRoot, bool enableOutgoingSeoUri)
Parameters
Type | Name | Description |
---|---|---|
System.Func<EPiServer.Core.ContentReference> | routeStartingPoint | A delegate that will return the content the route should be based on. |
CatalogContentBase | commerceRoot | The root node where this route will look for commerce content when matching route segments. |
System.Boolean | enableOutgoingSeoUri | Enables seo uri for outgoing route. |
HierarchicalCatalogPartialRouter(Func<ContentReference>, CatalogContentBase, Boolean, IContentLoader, LanguageSelectorFactory, IRoutingSegmentLoader)
Initialize a new instance of HierarchicalCatalogPartialRouter
Declaration
[Obsolete("Use the constructor with IContentLanguageSettingsHandler instead. Will remain at least until June 2016.")]
public HierarchicalCatalogPartialRouter(Func<ContentReference> routeStartingPoint, CatalogContentBase commerceRoot, bool supportSeoUri, IContentLoader contentLoader, LanguageSelectorFactory languageSelectorFactory, IRoutingSegmentLoader routingSegmentLoader)
Parameters
Type | Name | Description |
---|---|---|
System.Func<EPiServer.Core.ContentReference> | routeStartingPoint | A delegate that will return the content the route should be based on. |
CatalogContentBase | commerceRoot | The root node where this route will look for commerce content when matching route segments. |
System.Boolean | supportSeoUri | Enables seo uri for the route. |
EPiServer.IContentLoader | contentLoader | The content loader service. |
EPiServer.Core.LanguageSelectorFactory | languageSelectorFactory | The lanugage selector factory service. |
EPiServer.Web.Routing.Segments.IRoutingSegmentLoader | routingSegmentLoader | The routing segment loader service. |
HierarchicalCatalogPartialRouter(Func<ContentReference>, CatalogContentBase, Boolean, IContentLoader, LanguageSelectorFactory, IRoutingSegmentLoader, IContentVersionRepository)
Initialize a new instance of HierarchicalCatalogPartialRouter
Declaration
[Obsolete("Use the constructor with IContentLanguageSettingsHandler instead. Will remain at least until June 2016.")]
public HierarchicalCatalogPartialRouter(Func<ContentReference> routeStartingPoint, CatalogContentBase commerceRoot, bool supportSeoUri, IContentLoader contentLoader, LanguageSelectorFactory languageSelectorFactory, IRoutingSegmentLoader routingSegmentLoader, IContentVersionRepository contentVersionRepository)
Parameters
Type | Name | Description |
---|---|---|
System.Func<EPiServer.Core.ContentReference> | routeStartingPoint | A delegate that will return the content the route should be based on. |
CatalogContentBase | commerceRoot | The root node where this route will look for commerce content when matching route segments. |
System.Boolean | supportSeoUri | Enables seo uri for the route. |
EPiServer.IContentLoader | contentLoader | The content loader service. |
EPiServer.Core.LanguageSelectorFactory | languageSelectorFactory | The lanugage selector factory service. |
EPiServer.Web.Routing.Segments.IRoutingSegmentLoader | routingSegmentLoader | The routing segment loader service. |
EPiServer.Core.IContentVersionRepository | contentVersionRepository | The content version repository. |
HierarchicalCatalogPartialRouter(Func<ContentReference>, CatalogContentBase, Boolean, IContentLoader, LanguageSelectorFactory, IRoutingSegmentLoader, IContentVersionRepository, IUrlSegmentRouter, IContentLanguageSettingsHandler)
Initialize a new instance of HierarchicalCatalogPartialRouter
Declaration
[Obsolete("Use the constructor without LanguageSelectorFactory instead. Will remain at least until November 2016.")]
public HierarchicalCatalogPartialRouter(Func<ContentReference> routeStartingPoint, CatalogContentBase commerceRoot, bool supportSeoUri, IContentLoader contentLoader, LanguageSelectorFactory languageSelectorFactory, IRoutingSegmentLoader routingSegmentLoader, IContentVersionRepository contentVersionRepository, IUrlSegmentRouter urlSegmentRouter, IContentLanguageSettingsHandler contentLanguageSettingsHandler)
Parameters
Type | Name | Description |
---|---|---|
System.Func<EPiServer.Core.ContentReference> | routeStartingPoint | A delegate that will return the content the route should be based on. |
CatalogContentBase | commerceRoot | The root node where this route will look for commerce content when matching route segments. |
System.Boolean | supportSeoUri | Enables seo uri for the route. |
EPiServer.IContentLoader | contentLoader | The content loader service. |
EPiServer.Core.LanguageSelectorFactory | languageSelectorFactory | The lanugage selector factory service. |
EPiServer.Web.Routing.Segments.IRoutingSegmentLoader | routingSegmentLoader | The routing segment loader service. |
EPiServer.Core.IContentVersionRepository | contentVersionRepository | The content version repository. |
EPiServer.Web.Routing.Segments.IUrlSegmentRouter | urlSegmentRouter | The url segment router. |
EPiServer.Core.IContentLanguageSettingsHandler | contentLanguageSettingsHandler | The content language settings handler |
HierarchicalCatalogPartialRouter(Func<ContentReference>, CatalogContentBase, Boolean, IContentLoader, IRoutingSegmentLoader, IContentVersionRepository, IUrlSegmentRouter, IContentLanguageSettingsHandler)
Initialize a new instance of HierarchicalCatalogPartialRouter
Declaration
[Obsolete("Use the constructor with ServiceAccessor<HttpContextBase> instead. Will remain at least until June 2017.")]
public HierarchicalCatalogPartialRouter(Func<ContentReference> routeStartingPoint, CatalogContentBase commerceRoot, bool supportSeoUri, IContentLoader contentLoader, IRoutingSegmentLoader routingSegmentLoader, IContentVersionRepository contentVersionRepository, IUrlSegmentRouter urlSegmentRouter, IContentLanguageSettingsHandler contentLanguageSettingsHandler)
Parameters
Type | Name | Description |
---|---|---|
System.Func<EPiServer.Core.ContentReference> | routeStartingPoint | A delegate that will return the content the route should be based on. |
CatalogContentBase | commerceRoot | The root node where this route will look for commerce content when matching route segments. |
System.Boolean | supportSeoUri | Enables seo uri for the route. |
EPiServer.IContentLoader | contentLoader | The content loader service. |
EPiServer.Web.Routing.Segments.IRoutingSegmentLoader | routingSegmentLoader | The routing segment loader service. |
EPiServer.Core.IContentVersionRepository | contentVersionRepository | The content version repository. |
EPiServer.Web.Routing.Segments.IUrlSegmentRouter | urlSegmentRouter | The url segment router. |
EPiServer.Core.IContentLanguageSettingsHandler | contentLanguageSettingsHandler | The content language settings handler |
HierarchicalCatalogPartialRouter(Func<ContentReference>, CatalogContentBase, Boolean, IContentLoader, IRoutingSegmentLoader, IContentVersionRepository, IUrlSegmentRouter, IContentLanguageSettingsHandler, ServiceAccessor<HttpContextBase>)
Initialize a new instance of HierarchicalCatalogPartialRouter
Declaration
public HierarchicalCatalogPartialRouter(Func<ContentReference> routeStartingPoint, CatalogContentBase commerceRoot, bool supportSeoUri, IContentLoader contentLoader, IRoutingSegmentLoader routingSegmentLoader, IContentVersionRepository contentVersionRepository, IUrlSegmentRouter urlSegmentRouter, IContentLanguageSettingsHandler contentLanguageSettingsHandler, ServiceAccessor<HttpContextBase> httpContextAccessor)
Parameters
Type | Name | Description |
---|---|---|
System.Func<EPiServer.Core.ContentReference> | routeStartingPoint | A delegate that will return the content the route should be based on. |
CatalogContentBase | commerceRoot | The root node where this route will look for commerce content when matching route segments. |
System.Boolean | supportSeoUri | Enables seo uri for the route. |
EPiServer.IContentLoader | contentLoader | The content loader service. |
EPiServer.Web.Routing.Segments.IRoutingSegmentLoader | routingSegmentLoader | The routing segment loader service. |
EPiServer.Core.IContentVersionRepository | contentVersionRepository | The content version repository. |
EPiServer.Web.Routing.Segments.IUrlSegmentRouter | urlSegmentRouter | The url segment router. |
EPiServer.Core.IContentLanguageSettingsHandler | contentLanguageSettingsHandler | The content language settings handler |
EPiServer.ServiceLocation.ServiceAccessor<System.Web.HttpContextBase> | httpContextAccessor | The http context accessor |
HierarchicalCatalogPartialRouter(Func<ContentReference>, RootContent, Boolean)
Initialize a new instance of HierarchicalCatalogPartialRouter
Declaration
[Obsolete("Use the constructor with IContentLanguageSettingsHandler instead. Will remain at least until June 2016.")]
public HierarchicalCatalogPartialRouter(Func<ContentReference> routeStartingPoint, RootContent commerceRoot, bool enableOutgoingSeoUri)
Parameters
Type | Name | Description |
---|---|---|
System.Func<EPiServer.Core.ContentReference> | routeStartingPoint | A delegate that will return the content the route should be based on. |
RootContent | commerceRoot | The root node where this route will look for commerce content when matching route segments. |
System.Boolean | enableOutgoingSeoUri | Enables seo uri for outgoing route. |
Properties
CommerceRoot
The root of the route
Declaration
public virtual CatalogContentBase CommerceRoot { get; }
Property Value
Type | Description |
---|---|
CatalogContentBase |
EnableOutgoingSeoUri
Enables seo uri for outgoing route
Declaration
public virtual bool EnableOutgoingSeoUri { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
RouteStartingPoint
The content link just before the CommerceRoot
Declaration
public virtual ContentReference RouteStartingPoint { get; }
Property Value
Type | Description |
---|---|
EPiServer.Core.ContentReference |
Methods
FindNextContentInSegmentPair(CatalogContentBase, SegmentPair, SegmentContext, ILanguageSelector)
Finds the commerce content that matches one specific segment.
Declaration
[Obsolete("Use FindNextContentInSegmentPair(CatalogContentBase, SegmentPair, SegmentContext, CultureInfo) Will remain at least until November 2016.")]
protected virtual CatalogContentBase FindNextContentInSegmentPair(CatalogContentBase catalogContent, SegmentPair segmentPair, SegmentContext segmentContext, ILanguageSelector languageSelector)
Parameters
Type | Name | Description |
---|---|---|
CatalogContentBase | catalogContent | The content that matches the previous segment |
EPiServer.Web.Routing.Segments.SegmentPair | segmentPair | The current segment |
EPiServer.Web.Routing.Segments.SegmentContext | segmentContext | The complete segment context. |
EPiServer.Core.ILanguageSelector | languageSelector | The requested language. |
Returns
Type | Description |
---|---|
CatalogContentBase | The content that matches the specified segment |
FindNextContentInSegmentPair(CatalogContentBase, SegmentPair, SegmentContext, CultureInfo)
Finds the commerce content that matches one specific segment.
Declaration
protected virtual CatalogContentBase FindNextContentInSegmentPair(CatalogContentBase catalogContent, SegmentPair segmentPair, SegmentContext segmentContext, CultureInfo cultureInfo)
Parameters
Type | Name | Description |
---|---|---|
CatalogContentBase | catalogContent | The content that matches the previous segment |
EPiServer.Web.Routing.Segments.SegmentPair | segmentPair | The current segment |
EPiServer.Web.Routing.Segments.SegmentContext | segmentContext | The complete segment context. |
System.Globalization.CultureInfo | cultureInfo | The requested cultureInfo. |
Returns
Type | Description |
---|---|
CatalogContentBase | The content that matches the specified segment |
GetCatalogContentRecursive(CatalogContentBase, SegmentPair, SegmentContext, ILanguageSelector)
Finds the commerce content that matches the provided segment context by recursivly going through all segments.
Declaration
[Obsolete("Use GetCatalogContentRecursive(CatalogContentBase, SegmentPair, SegmentContext, CultureInfo) Will remain at least until November 2016.")]
protected virtual CatalogContentBase GetCatalogContentRecursive(CatalogContentBase catalogContent, SegmentPair segmentPair, SegmentContext segmentContext, ILanguageSelector languageSelector)
Parameters
Type | Name | Description |
---|---|---|
CatalogContentBase | catalogContent | The currently active or matched content. |
EPiServer.Web.Routing.Segments.SegmentPair | segmentPair | The currently active segment. |
EPiServer.Web.Routing.Segments.SegmentContext | segmentContext | The complete segment context. |
EPiServer.Core.ILanguageSelector | languageSelector | The requested language. |
Returns
Type | Description |
---|---|
CatalogContentBase | The content that matches the provided segment context. |
GetCatalogContentRecursive(CatalogContentBase, SegmentPair, SegmentContext, CultureInfo)
Finds the commerce content that matches the provided segment context by recursivly going through all segments.
Declaration
protected virtual CatalogContentBase GetCatalogContentRecursive(CatalogContentBase catalogContent, SegmentPair segmentPair, SegmentContext segmentContext, CultureInfo cultureInfo)
Parameters
Type | Name | Description |
---|---|---|
CatalogContentBase | catalogContent | The currently active or matched content. |
EPiServer.Web.Routing.Segments.SegmentPair | segmentPair | The currently active segment. |
EPiServer.Web.Routing.Segments.SegmentContext | segmentContext | The complete segment culture. |
System.Globalization.CultureInfo | cultureInfo | The requested culture. |
Returns
Type | Description |
---|---|
CatalogContentBase | The content that matches the provided segment context. |
GetPartialVirtualPath(CatalogContentBase, String, RouteValueDictionary, RequestContext)
Gets a partial virtual path for a content item during routing.
Declaration
public virtual PartialRouteData GetPartialVirtualPath(CatalogContentBase content, string language, RouteValueDictionary routeValues, RequestContext requestContext)
Parameters
Type | Name | Description |
---|---|---|
CatalogContentBase | content | The content to generate a virtual path for. |
System.String | language | The language to generate the url for. |
System.Web.Routing.RouteValueDictionary | routeValues | The route values. |
System.Web.Routing.RequestContext | requestContext | The request context. |
Returns
Type | Description |
---|---|
EPiServer.Web.Routing.PartialRouteData | A EPiServer.Web.Routing.PartialRouteData containing the partial virtual path for the content and a EPiServer.Core.ContentReference to the item to get base path from or null if the remaining part did not match. |
IsValidRoutedContent(CatalogContentBase)
Checks if a content is a valid match for a partial route.
Declaration
protected virtual bool IsValidRoutedContent(CatalogContentBase content)
Parameters
Type | Name | Description |
---|---|---|
CatalogContentBase | content | The content to validate |
Returns
Type | Description |
---|---|
System.Boolean |
|
RoutePartial(PageData, SegmentContext)
Matches a route by traversing the route segments and matching them with the url segments of the commerce content.
Declaration
public virtual object RoutePartial(PageData content, SegmentContext segmentContext)
Parameters
Type | Name | Description |
---|---|---|
EPiServer.Core.PageData | content | The content that the page route has been able to route to. |
EPiServer.Web.Routing.Segments.SegmentContext | segmentContext | The segment context containing the remaining part of url. |
Returns
Type | Description |
---|---|
System.Object | A EPiServer.Core.ContentReference to the mathced data or null if the remaining part did not match. |
Remarks
Only CatalogContentBase will be returned. If the route matches any other type of content, that will be ignored.
Examples
http://mysite/catalog/catalognode/entry
TryGetRouteSegment(ContentReference, String, out String)
Tries to retrieve the route segment for the content.
Declaration
protected virtual bool TryGetRouteSegment(ContentReference contentLink, string language, out string segment)
Parameters
Type | Name | Description |
---|---|---|
EPiServer.Core.ContentReference | contentLink | The content link. |
System.String | language | The language. |
System.String | segment | The segment to be retrieved. |
Returns
Type | Description |
---|---|
System.Boolean | True if the route segment could be retrieved, false otherwise. |
TryGetVirtualPath(HttpContextBase, CatalogContentBase, String, out String)
Tries to retrive the virtual path for the content.
Declaration
protected virtual bool TryGetVirtualPath(HttpContextBase context, CatalogContentBase content, string language, out string virtualPath)
Parameters
Type | Name | Description |
---|---|---|
System.Web.HttpContextBase | context | The http context. |
CatalogContentBase | content | The content. |
System.String | language | The language. |
System.String | virtualPath | The virtual path to be retrieved. |
Returns
Type | Description |
---|---|
System.Boolean | True if the virtual path could be retrieved, false otherwise. |