Table of contents
Partial routing makes it possible to extend routing beyond pages. You can use partial routing either to route to data outside EPiServer CMS or to route to other content types than pages.
An example can be an URL like http://site/News/Sports/TheGame/. In the example the part of the URL that is http://site/News/ could represent the URL to a page instance of model type NewsContainer. Then by registering a partial router for ModelType NewsContainer the partial router can take care of routing the remaining part of the URL. In the example the partial router would take care of routing the part 'Sports/TheGame/'.
The IPartialRouter interface
Each partial router must implement the interface EPiServer.Web.Routing.IPartialRouter<TContent, TRoutedData> that resides in the EPiServer.dll assembly. The interface is a generic interface with generic constraints where TContent : EPiServer.Core.IContent.
The interface contains the following methods:
- RoutePartial. This method is called when the ordinary page routing has routed to a page of type TContent and there is a remaining part of the URL. The implemenation can then route the remaing part of the URL.
- GetPartialVirtualPath. This method is called when an outgoing URL is constructed for a content instance of type TOutgoing.
- Refer to the section News Partial Routing in the EPiServer CMS SDK for an example of partial routing.
- In the Relate template package there is an implementation of partial routing for blogs and blog entries.
- Refer to the Content provider section in the EPiServer CMS SDK for more information about content providers.
- In the framework reference part of the EPiServer CMS SDK there is more information on the EPiServer.Web.Routing.IPartialRouter<TContent, TRoutedData> and base class EPiServer.Core.ContentProvider.