Class UmbracoApiControllerBase
Provides a base class for Umbraco API controllers.
Inheritance
System.Object
Namespace: Umbraco.Web.WebApi
Assembly: Umbraco.Web.dll
Syntax
public abstract class UmbracoApiControllerBase : ApiController
Remarks
These controllers are NOT auto-routed.
Constructors
View SourceUmbracoApiControllerBase()
Initializes a new instance of the UmbracoApiControllerBase class with auto dependencies.
Declaration
protected UmbracoApiControllerBase()
Remarks
Dependencies are obtained from the Current service locator.
UmbracoApiControllerBase(IGlobalSettings, IUmbracoContextAccessor, ISqlContext, ServiceContext, AppCaches, IProfilingLogger, IRuntimeState, UmbracoHelper)
Declaration
[Obsolete("This constructor is obsolete since it doesn't inject the UmbracoMapper. The UmbracoMapper will be resolved from the service locator Current.Mapper, which is not good for testability. Inject the UmbracoMapper using full constructor injection instead.")]
protected UmbracoApiControllerBase(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper)
Parameters
Type | Name | Description |
---|---|---|
IGlobalSettings | globalSettings | |
IUmbracoContextAccessor | umbracoContextAccessor | |
ISqlContext | sqlContext | |
ServiceContext | services | |
AppCaches | appCaches | |
IProfilingLogger | logger | |
IRuntimeState | runtimeState | |
UmbracoHelper | umbracoHelper |
UmbracoApiControllerBase(IGlobalSettings, IUmbracoContextAccessor, ISqlContext, ServiceContext, AppCaches, IProfilingLogger, IRuntimeState, UmbracoHelper, UmbracoMapper)
Initializes a new instance of the UmbracoApiControllerBase class with all its dependencies.
Declaration
protected UmbracoApiControllerBase(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper, UmbracoMapper umbracoMapper)
Parameters
Type | Name | Description |
---|---|---|
IGlobalSettings | globalSettings | |
IUmbracoContextAccessor | umbracoContextAccessor | |
ISqlContext | sqlContext | |
ServiceContext | services | |
AppCaches | appCaches | |
IProfilingLogger | logger | |
IRuntimeState | runtimeState | |
UmbracoHelper | umbracoHelper | |
UmbracoMapper | umbracoMapper |
Properties
View SourceAppCaches
Gets the application cache.
Declaration
public AppCaches AppCaches { get; }
Property Value
Type | Description |
---|---|
AppCaches |
ApplicationUrl
Gets the application URL.
Declaration
protected Uri ApplicationUrl { get; }
Property Value
Type | Description |
---|---|
System.Uri |
GlobalSettings
Gets the Umbraco context.
Declaration
public virtual IGlobalSettings GlobalSettings { get; }
Property Value
Type | Description |
---|---|
IGlobalSettings |
Logger
Gets the logger.
Declaration
public IProfilingLogger Logger { get; }
Property Value
Type | Description |
---|---|
IProfilingLogger |
Mapper
Gets the mapper.
Declaration
public UmbracoMapper Mapper { get; }
Property Value
Type | Description |
---|---|
UmbracoMapper |
Members
Gets the membership helper.
Declaration
public MembershipHelper Members { get; }
Property Value
Type | Description |
---|---|
MembershipHelper |
Security
Gets the web security helper.
Declaration
public WebSecurity Security { get; }
Property Value
Type | Description |
---|---|
WebSecurity |
Services
Gets the services context.
Declaration
public ServiceContext Services { get; }
Property Value
Type | Description |
---|---|
ServiceContext |
SqlContext
Gets the sql context.
Declaration
public ISqlContext SqlContext { get; }
Property Value
Type | Description |
---|---|
ISqlContext |
Umbraco
Gets the Umbraco helper.
Declaration
public UmbracoHelper Umbraco { get; }
Property Value
Type | Description |
---|---|
UmbracoHelper |
UmbracoContext
Gets the Umbraco context.
Declaration
public virtual UmbracoContext UmbracoContext { get; }
Property Value
Type | Description |
---|---|
UmbracoContext |
UmbracoContextAccessor
Gets the Umbraco context accessor.
Declaration
public virtual IUmbracoContextAccessor UmbracoContextAccessor { get; }
Property Value
Type | Description |
---|---|
IUmbracoContextAccessor |
Methods
View SourceTryGetHttpContext()
Tries to get the current HttpContext.
Declaration
protected Attempt<HttpContextBase> TryGetHttpContext()
Returns
Type | Description |
---|---|
Attempt<System.Web.HttpContextBase> |
TryGetOwinContext()
Tries to get the current OWIN context.
Declaration
protected Attempt<IOwinContext> TryGetOwinContext()
Returns
Type | Description |
---|---|
Attempt<IOwinContext> |