Class PermanentLinkMapper
Uses PermanentLinkMapStore for mapping between url/Guid/PageReference
Inheritance
Implements
Inherited Members
Namespace: EPiServer.Web
Assembly: EPiServer.dll
Version: 8.11.0Syntax
[ServiceConfiguration(ServiceType = typeof(IPermanentLinkMapper), FactoryMember = "Instance", Lifecycle = ServiceInstanceScope.Singleton)]
public class PermanentLinkMapper : IPermanentLinkMapper
Constructors
PermanentLinkMapper(PermanentContentLinkMapper, PermanentFileLinkMapper)
Declaration
public PermanentLinkMapper(PermanentContentLinkMapper pageMapper, PermanentFileLinkMapper fileMapper)
Parameters
Type | Name | Description |
---|---|---|
PermanentContentLinkMapper | pageMapper | |
PermanentFileLinkMapper | fileMapper |
Properties
CacheCount
Gets the number of items in the cache.
Declaration
public int CacheCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The cache count. |
GuidResolver
Gets or sets a func that resolves a guid from the specified UrlBuilder that will replace the default call to GetGuid(String, out String) when finding a specific url.
Declaration
public Func<UrlBuilder, Guid> GuidResolver { get; set; }
Property Value
Type | Description |
---|---|
System.Func<UrlBuilder, System.Guid> |
Instance
The global permanent link mapper instance. This is not intended to be set by external code.
Declaration
public static IPermanentLinkMapper Instance { get; set; }
Property Value
Type | Description |
---|---|
IPermanentLinkMapper |
PerformanceCounters
Gets the collection of performance counters
Declaration
public PermanentLinkMapStore.Counters PerformanceCounters { get; }
Property Value
Type | Description |
---|---|
PermanentLinkMapStore.Counters |
Methods
Clear()
Clears the cache.
Declaration
public void Clear()
ClearCache(Boolean)
Clears the cache. Optionally this event is broadcasted.
Declaration
public void ClearCache(bool raiseEvent)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | raiseEvent | if set to |
ClearItemFromCache(Guid, Boolean)
Removes the item with specified id from cache. If raiseEvent is true the cache removal is broadcasted.
Declaration
public void ClearItemFromCache(Guid itemId, bool raiseEvent)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | itemId | The item id. |
System.Boolean | raiseEvent | if set to |
Find(ContentReference)
Finds a PermanentLinkMap-derived instance from the specified page reference.
Declaration
public virtual PermanentContentLinkMap Find(ContentReference contentReference)
Parameters
Type | Name | Description |
---|---|---|
ContentReference | contentReference | The page reference. |
Returns
Type | Description |
---|---|
PermanentContentLinkMap | A link map, or null if not found |
Find(UrlBuilder)
Finds an PermanentLinkMap-derived instance from the provided url, if possible.
Declaration
public virtual PermanentLinkMap Find(UrlBuilder url)
Parameters
Type | Name | Description |
---|---|---|
UrlBuilder | url | The URL, which may be in permanent link format, or mapped format |
Returns
Type | Description |
---|---|
PermanentLinkMap | The mapping object or null |
Find(Guid)
Creates an PermanentLinkMap-derived instance from the provided Guid, if possible.
Declaration
public virtual PermanentLinkMap Find(Guid guid)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | guid | The Guid |
Returns
Type | Description |
---|---|
PermanentLinkMap | The mapping object or null |
Find(Guid, PermanentLinkMapStore.StorePreference)
Finds the specified GUID.
Declaration
public virtual PermanentLinkMap Find(Guid guid, PermanentLinkMapStore.StorePreference preferredStore)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | guid | The GUID. |
PermanentLinkMapStore.StorePreference | preferredStore | The preferred store. |
Returns
Type | Description |
---|---|
PermanentLinkMap |
Initialize(IContentEvents, IContentLoader)
Declaration
public void Initialize(IContentEvents contentEvents, IContentLoader contentLoader)
Parameters
Type | Name | Description |
---|---|---|
IContentEvents | contentEvents | |
IContentLoader | contentLoader |
RemovePageFromCache(ContentReference)
Removes link information about the page from link store cache.
Declaration
public void RemovePageFromCache(ContentReference contentLink)
Parameters
Type | Name | Description |
---|---|---|
ContentReference | contentLink | The page link. |
Save(PermanentLinkMap)
Saves the specified PermanentLinkMap to the repository, making it available for lookup.
Declaration
public void Save(PermanentLinkMap plm)
Parameters
Type | Name | Description |
---|---|---|
PermanentLinkMap | plm | The PermanentLinkMap |
Remarks
This method must be called whenever a new mapping is created, or an existing one has some aspect modified to save it to the backing store (actually an in-memory cache in this implementation).
ToMapped(UrlBuilder)
Converts the provided URL to the mapped representation, if possible.
Declaration
public virtual bool ToMapped(UrlBuilder url)
Parameters
Type | Name | Description |
---|---|---|
UrlBuilder | url | The URL. It may be permanent or mapped to begin with. |
Returns
Type | Description |
---|---|
System.Boolean | true if a mapped representation is provided after the call |
ToPermanent(UrlBuilder)
Converts the provided URL to the permanent link representation, if possible.
Declaration
public virtual bool ToPermanent(UrlBuilder url)
Parameters
Type | Name | Description |
---|---|---|
UrlBuilder | url | The URL. It may be permanent or mapped to begin with. |
Returns
Type | Description |
---|---|
System.Boolean | true if a permanent link representation is provided after the call |
TryToMapped(String, out String)
Converts the provided URL to the mapped representation, if possible.
Declaration
public virtual bool TryToMapped(string url, out string mappedUrl)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The URL. It may be permanent or mapped to begin with. |
System.String | mappedUrl | The resulting mapped URL, if the conversion was possible (or unnecessary) |
Returns
Type | Description |
---|---|
System.Boolean | true if a mapped representation is provided after the call. |
TryToPermanent(String, out String)
Converts the provided URL to the permanent link representation, if possible.
Declaration
public virtual bool TryToPermanent(string url, out string permanentUrl)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The URL. It may be permanent or mapped to begin with. |
System.String | permanentUrl | The resulting permanent link URL, if the conversion was possible (or unnecessary) |
Returns
Type | Description |
---|---|
System.Boolean | true if a permanent link representation is provided after the call. |