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
{
///
/// An abstract web service class exposing common umbraco objects
///
public abstract class UmbracoWebService : WebService
{
private UrlHelper _url;
protected UmbracoWebService()
{
UmbracoContext = Current.UmbracoContext;
Umbraco = new UmbracoHelper(UmbracoContext, Current.Services, Current.ApplicationCache);
Logger = Current.Logger;
ProfilingLogger = Current.ProfilingLogger;
Services = Current.Services;
GlobalSettings = UmbracoConfig.For.GlobalSettings();
}
///
/// Gets the logger.
///
public ILogger Logger { get; }
///
/// Gets the ProfilingLogger.
///
public ProfilingLogger ProfilingLogger { get; }
///
/// Gets the Umbraco context.
///
public UmbracoContext UmbracoContext { get; }
///
/// Gets the Umbraco helper.
///
public UmbracoHelper Umbraco { get; }
///
/// Gets the services context.
///
public ServiceContext Services { get; }
///
/// Gets the global settings.
///
public IGlobalSettings GlobalSettings { get; }
///
/// Gets the web security helper.
///
public WebSecurity Security => UmbracoContext.Security;
///
/// Gets the Url helper.
///
/// This URL helper is created without any route data and an empty request context.
public UrlHelper Url => _url ?? (_url = new UrlHelper(Context.Request.RequestContext));
}
}