Inject IUmbracoContextAccessor instead of UmbracoContext
This commit is contained in:
@@ -33,7 +33,7 @@ namespace Umbraco.Web.WebApi
|
||||
protected UmbracoApiControllerBase()
|
||||
: this(
|
||||
Current.Factory.GetInstance<IGlobalSettings>(),
|
||||
Current.Factory.GetInstance<IUmbracoContextAccessor>().UmbracoContext,
|
||||
Current.Factory.GetInstance<IUmbracoContextAccessor>(),
|
||||
Current.Factory.GetInstance<ISqlContext>(),
|
||||
Current.Factory.GetInstance<ServiceContext>(),
|
||||
Current.Factory.GetInstance<AppCaches>(),
|
||||
@@ -46,15 +46,15 @@ namespace Umbraco.Web.WebApi
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UmbracoApiControllerBase"/> class with all its dependencies.
|
||||
/// </summary>
|
||||
protected UmbracoApiControllerBase(IGlobalSettings globalSettings, UmbracoContext umbracoContext, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper)
|
||||
protected UmbracoApiControllerBase(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper)
|
||||
{
|
||||
UmbracoContextAccessor = umbracoContextAccessor;
|
||||
GlobalSettings = globalSettings;
|
||||
SqlContext = sqlContext;
|
||||
Services = services;
|
||||
AppCaches = appCaches;
|
||||
Logger = logger;
|
||||
RuntimeState = runtimeState;
|
||||
UmbracoContext = umbracoContext;
|
||||
Umbraco = umbracoHelper;
|
||||
}
|
||||
|
||||
@@ -72,8 +72,14 @@ namespace Umbraco.Web.WebApi
|
||||
/// <summary>
|
||||
/// Gets the Umbraco context.
|
||||
/// </summary>
|
||||
public virtual UmbracoContext UmbracoContext { get; }
|
||||
|
||||
public virtual UmbracoContext UmbracoContext => UmbracoContextAccessor.UmbracoContext;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Umbraco context accessor.
|
||||
/// </summary>
|
||||
public virtual IUmbracoContextAccessor UmbracoContextAccessor { get; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sql context.
|
||||
/// </summary>
|
||||
@@ -113,7 +119,7 @@ namespace Umbraco.Web.WebApi
|
||||
/// Gets the Umbraco helper.
|
||||
/// </summary>
|
||||
public UmbracoHelper Umbraco { get; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the web security helper.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user