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.
DocumentationRootUrlGets the absolute or document-relative URL to the documentation root for the current context.
IsDocumentationRootGets a value indicating whether the current document is at the documentation root.
ModelGets the document model associated with the current context.

Methods

Dispose()Disposes the current instance and restores the previous URL context.
ResolveFromDocumentationRoot(string)Resolves a documentation-root-relative URL into an absolute or document-relative URL.
TryResolveUrl(string, out string)Attempts to resolve a documentation-root-relative URL into an absolute or document-relative URL.

See Also