DocumentUrlContext Class

Namespace
Kampute.DocToolkit.Routing
Assembly
  • Kampute.DocToolkit.dll

Definition

Represents a disposable context that manages relative URL resolution within a document context.
public abstract class DocumentUrlContext : IDisposable
Inheritance
Implements

Remarks

This abstract class represents a temporary context for URL adjustment that's specific to the document currently being rendered. It provides access to the base URL used for normalizing relative URLs and ensures the context is properly terminated when document processing is complete.

The concrete implementation of this class is responsible for managing the state of the URL adjustment context and ensuring that the base URL is correctly set based on the current document's location within the documentation site.

When the context is disposed, any state modifications related to the current document context should be reverted, restoring the previous URL adjustment context.

Thread Safety

All public members of the type are guaranteed to be thread-safe.

Constructors

DocumentUrlContext(string, IDocumentModel)Initializes a new instance of the DocumentUrlContext class.

Properties

DirectoryGets the current document directory path relative to the documentation root.
IsRootGets a value indicating whether the current document is at the root level of the documentation site.
ModelGets the document model associated with the current context.
RootUrlGets the absolute or relative URL to the root of the documentation site for the current context.

Methods

Dispose()Disposes the current instance and restores the previous URL context.
IsSiteRelativeUrl(string)Determines whether the specified URL string is a site-relative URL.
TryTransformSiteRelativeUrl(string, out string)Attempts to transform a site-relative URL string into an absolute or document-relative URL based on the current context.

See Also