* Removing properties related to IPublishedContentQuery, ITagQuery, ICultureDictionaryFactory, IUmbracoComponentRenderer from UmbracoHelper and using the corresponding private fields instead. Removing Media related methods * Removed UmbracoHelper from UmbracoApiControllerBase * Removed UmbracoHelper references * Inject the needed Interfaces to classes that previously used UmbracoHelper to get the same functionality * Fixed tests referencing UmbracoHelper * Adding Media methods back * Cleanup and moved UmbracoHelper from more base classes, when not used + simplified tests * Reintroduced some methods.. * Reintroduced some methods.. * Reintroducing last missing bits Co-authored-by: Bjarke Berg <mail@bergmania.dk>
80 lines
2.4 KiB
C#
80 lines
2.4 KiB
C#
using System;
|
|
using System.Web;
|
|
using System.Web.Mvc;
|
|
using System.Web.Routing;
|
|
using System.Web.Services;
|
|
using Umbraco.Core;
|
|
using Umbraco.Core.Cache;
|
|
using Umbraco.Core.Configuration;
|
|
using Umbraco.Core.Logging;
|
|
using Umbraco.Core.Persistence;
|
|
using Umbraco.Core.Services;
|
|
using Umbraco.Web.Composing;
|
|
using Umbraco.Web.Security;
|
|
|
|
namespace Umbraco.Web
|
|
{
|
|
/// <summary>
|
|
/// An abstract web service class exposing common umbraco objects
|
|
/// </summary>
|
|
public abstract class UmbracoWebService : WebService
|
|
{
|
|
private UrlHelper _url;
|
|
|
|
protected UmbracoWebService(IProfilingLogger profilingLogger, IUmbracoContextAccessor umbracoContextAccessor, ServiceContext services, IGlobalSettings globalSettings)
|
|
{
|
|
Logger = profilingLogger;
|
|
ProfilingLogger = profilingLogger;
|
|
UmbracoContextAccessor = umbracoContextAccessor;
|
|
Services = services;
|
|
GlobalSettings = globalSettings;
|
|
}
|
|
|
|
protected UmbracoWebService()
|
|
: this(Current.ProfilingLogger, Current.UmbracoContextAccessor, Current.Services, Current.Configs.Global())
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets the logger.
|
|
/// </summary>
|
|
public ILogger Logger { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the ProfilingLogger.
|
|
/// </summary>
|
|
public IProfilingLogger ProfilingLogger { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the Umbraco context.
|
|
/// </summary>
|
|
public IUmbracoContext UmbracoContext => UmbracoContextAccessor.UmbracoContext;
|
|
|
|
/// <summary>
|
|
/// Gets the Umbraco context accessor.
|
|
/// </summary>
|
|
public IUmbracoContextAccessor UmbracoContextAccessor { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the services context.
|
|
/// </summary>
|
|
public ServiceContext Services { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the global settings.
|
|
/// </summary>
|
|
public IGlobalSettings GlobalSettings { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the web security helper.
|
|
/// </summary>
|
|
public IWebSecurity Security => UmbracoContext.Security;
|
|
|
|
/// <summary>
|
|
/// Gets the Url helper.
|
|
/// </summary>
|
|
/// <remarks>This URL helper is created without any route data and an empty request context.</remarks>
|
|
public UrlHelper Url => _url ?? (_url = new UrlHelper(Context.Request.RequestContext));
|
|
}
|
|
}
|