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 Hierarchical
Declaration
public HierarchicalCatalogPartialRouter(Func<ContentReference> routeStartingPoint, CatalogContentBase commerceRoot, bool enableOutgoingSeoUri)
Parameters
Type | Name | Description |
---|---|---|
System. |
routeStartingPoint | A delegate that will return the content the route should be based on. |
Catalog |
commerceRoot | The root node where this route will look for commerce content when matching route segments. |
System. |
enableOutgoingSeoUri | Enables seo uri for outgoing route. |
HierarchicalCatalogPartialRouter(Func<ContentReference>, CatalogContentBase, Boolean, IContentLoader, LanguageSelectorFactory, IRoutingSegmentLoader)
Initialize a new instance of Hierarchical
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. |
routeStartingPoint | A delegate that will return the content the route should be based on. |
Catalog |
commerceRoot | The root node where this route will look for commerce content when matching route segments. |
System. |
supportSeoUri | Enables seo uri for the route. |
EPi |
contentLoader | The content loader service. |
EPi |
languageSelectorFactory | The lanugage selector factory service. |
EPi |
routingSegmentLoader | The routing segment loader service. |
HierarchicalCatalogPartialRouter(Func<ContentReference>, CatalogContentBase, Boolean, IContentLoader, LanguageSelectorFactory, IRoutingSegmentLoader, IContentVersionRepository)
Initialize a new instance of Hierarchical
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. |
routeStartingPoint | A delegate that will return the content the route should be based on. |
Catalog |
commerceRoot | The root node where this route will look for commerce content when matching route segments. |
System. |
supportSeoUri | Enables seo uri for the route. |
EPi |
contentLoader | The content loader service. |
EPi |
languageSelectorFactory | The lanugage selector factory service. |
EPi |
routingSegmentLoader | The routing segment loader service. |
EPi |
contentVersionRepository | The content version repository. |
HierarchicalCatalogPartialRouter(Func<ContentReference>, CatalogContentBase, Boolean, IContentLoader, LanguageSelectorFactory, IRoutingSegmentLoader, IContentVersionRepository, IUrlSegmentRouter, IContentLanguageSettingsHandler)
Initialize a new instance of Hierarchical
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. |
routeStartingPoint | A delegate that will return the content the route should be based on. |
Catalog |
commerceRoot | The root node where this route will look for commerce content when matching route segments. |
System. |
supportSeoUri | Enables seo uri for the route. |
EPi |
contentLoader | The content loader service. |
EPi |
languageSelectorFactory | The lanugage selector factory service. |
EPi |
routingSegmentLoader | The routing segment loader service. |
EPi |
contentVersionRepository | The content version repository. |
EPi |
urlSegmentRouter | The url segment router. |
EPi |
contentLanguageSettingsHandler | The content language settings handler |
HierarchicalCatalogPartialRouter(Func<ContentReference>, CatalogContentBase, Boolean, IContentLoader, IRoutingSegmentLoader, IContentVersionRepository, IUrlSegmentRouter, IContentLanguageSettingsHandler)
Initialize a new instance of Hierarchical
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. |
routeStartingPoint | A delegate that will return the content the route should be based on. |
Catalog |
commerceRoot | The root node where this route will look for commerce content when matching route segments. |
System. |
supportSeoUri | Enables seo uri for the route. |
EPi |
contentLoader | The content loader service. |
EPi |
routingSegmentLoader | The routing segment loader service. |
EPi |
contentVersionRepository | The content version repository. |
EPi |
urlSegmentRouter | The url segment router. |
EPi |
contentLanguageSettingsHandler | The content language settings handler |
HierarchicalCatalogPartialRouter(Func<ContentReference>, CatalogContentBase, Boolean, IContentLoader, IRoutingSegmentLoader, IContentVersionRepository, IUrlSegmentRouter, IContentLanguageSettingsHandler, ServiceAccessor<HttpContextBase>)
Initialize a new instance of Hierarchical
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. |
routeStartingPoint | A delegate that will return the content the route should be based on. |
Catalog |
commerceRoot | The root node where this route will look for commerce content when matching route segments. |
System. |
supportSeoUri | Enables seo uri for the route. |
EPi |
contentLoader | The content loader service. |
EPi |
routingSegmentLoader | The routing segment loader service. |
EPi |
contentVersionRepository | The content version repository. |
EPi |
urlSegmentRouter | The url segment router. |
EPi |
contentLanguageSettingsHandler | The content language settings handler |
EPi |
httpContextAccessor | The http context accessor |
HierarchicalCatalogPartialRouter(Func<ContentReference>, RootContent, Boolean)
Initialize a new instance of Hierarchical
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. |
routeStartingPoint | A delegate that will return the content the route should be based on. |
Root |
commerceRoot | The root node where this route will look for commerce content when matching route segments. |
System. |
enableOutgoingSeoUri | Enables seo uri for outgoing route. |
Properties
CommerceRoot
The root of the route
Declaration
public virtual CatalogContentBase CommerceRoot { get; }
Property Value
Type | Description |
---|---|
Catalog |
EnableOutgoingSeoUri
Enables seo uri for outgoing route
Declaration
public virtual bool EnableOutgoingSeoUri { get; }
Property Value
Type | Description |
---|---|
System. |
RouteStartingPoint
The content link just before the Commerce
Declaration
public virtual ContentReference RouteStartingPoint { get; }
Property Value
Type | Description |
---|---|
EPi |
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 |
---|---|---|
Catalog |
catalogContent | The content that matches the previous segment |
EPi |
segmentPair | The current segment |
EPi |
segmentContext | The complete segment context. |
EPi |
languageSelector | The requested language. |
Returns
Type | Description |
---|---|
Catalog |
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 |
---|---|---|
Catalog |
catalogContent | The content that matches the previous segment |
EPi |
segmentPair | The current segment |
EPi |
segmentContext | The complete segment context. |
System. |
cultureInfo | The requested cultureInfo. |
Returns
Type | Description |
---|---|
Catalog |
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 |
---|---|---|
Catalog |
catalogContent | The currently active or matched content. |
EPi |
segmentPair | The currently active segment. |
EPi |
segmentContext | The complete segment context. |
EPi |
languageSelector | The requested language. |
Returns
Type | Description |
---|---|
Catalog |
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 |
---|---|---|
Catalog |
catalogContent | The currently active or matched content. |
EPi |
segmentPair | The currently active segment. |
EPi |
segmentContext | The complete segment culture. |
System. |
cultureInfo | The requested culture. |
Returns
Type | Description |
---|---|
Catalog |
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 |
---|---|---|
Catalog |
content | The content to generate a virtual path for. |
System. |
language | The language to generate the url for. |
System. |
routeValues | The route values. |
System. |
requestContext | The request context. |
Returns
Type | Description |
---|---|
EPi |
A EPi |
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 |
---|---|---|
Catalog |
content | The content to validate |
Returns
Type | Description |
---|---|
System. |
|
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 |
---|---|---|
EPi |
content | The content that the page route has been able to route to. |
EPi |
segmentContext | The segment context containing the remaining part of url. |
Returns
Type | Description |
---|---|
System. |
A EPi |
Remarks
Only Catalog
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 |
---|---|---|
EPi |
contentLink | The content link. |
System. |
language | The language. |
System. |
segment | The segment to be retrieved. |
Returns
Type | Description |
---|---|
System. |
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. |
context | The http context. |
Catalog |
content | The content. |
System. |
language | The language. |
System. |
virtualPath | The virtual path to be retrieved. |
Returns
Type | Description |
---|---|
System. |
True if the virtual path could be retrieved, false otherwise. |