Class UmbracoContextAccessorExtensions
Provides extension methods for IUmbracoContextAccessor.
Inheritance
object
Namespace: Umbraco.Extensions
Assembly: Umbraco.Core.dll
Syntax
public static class UmbracoContextAccessorExtensions
Methods
View SourceGetRequiredUmbracoContext(IUmbracoContextAccessor)
Gets the Umbraco context, throwing an exception if it is not available.
Declaration
public static IUmbracoContext GetRequiredUmbracoContext(this IUmbracoContextAccessor umbracoContextAccessor)
Parameters
| Type | Name | Description |
|---|---|---|
| IUmbracoContextAccessor | umbracoContextAccessor | The Umbraco context accessor. |
Returns
| Type | Description |
|---|---|
| IUmbracoContext | The current Umbraco context. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when the accessor is null. |
| InvalidOperationException | Thrown when the Umbraco context is not available. |