Files
Umbraco-CMS/src/Umbraco.Web.BackOffice/AspNetCore/AspNetCoreHostingEnvironment.cs

61 lines
2.1 KiB
C#
Raw Normal View History

2020-02-18 08:32:06 +01:00
using System;
2020-02-20 07:55:24 +01:00
using System.IO;
2020-02-18 08:32:06 +01:00
using Microsoft.AspNetCore.Hosting;
using Umbraco.Core;
using Umbraco.Core.Configuration;
namespace Umbraco.Web.BackOffice.AspNetCore
{
public class AspNetCoreHostingEnvironment : Umbraco.Core.Hosting.IHostingEnvironment
{
private readonly IHostingSettings _hostingSettings;
2020-02-20 07:55:24 +01:00
private readonly IWebHostEnvironment _webHostEnvironment;
2020-02-18 08:32:06 +01:00
2020-02-20 07:55:24 +01:00
public AspNetCoreHostingEnvironment(IHostingSettings hostingSettings, IWebHostEnvironment webHostEnvironment)
2020-02-18 08:32:06 +01:00
{
2020-02-20 07:55:24 +01:00
_hostingSettings = hostingSettings ?? throw new ArgumentNullException(nameof(hostingSettings));
_webHostEnvironment = webHostEnvironment;
SiteName = webHostEnvironment.ApplicationName;
ApplicationPhysicalPath = webHostEnvironment.ContentRootPath;
IsHosted = true;
ApplicationVirtualPath = "/"; //TODO how to find this, This is a server thing, not application thing.
ApplicationId = AppDomain.CurrentDomain.Id.ToString();
CurrentDomainId = AppDomain.CurrentDomain.Id;
2020-02-18 08:32:06 +01:00
// IISVersion = HttpRuntime.IISVersion;
}
public string SiteName { get; }
public string ApplicationId { get; }
public string ApplicationPhysicalPath { get; }
public string LocalTempPath { get; }
public string ApplicationVirtualPath { get; }
public int CurrentDomainId { get; }
2020-02-20 07:55:24 +01:00
public bool IsDebugMode => _hostingSettings.DebugMode;
2020-02-18 08:32:06 +01:00
public bool IsHosted { get; }
public Version IISVersion { get; }
2020-02-20 07:55:24 +01:00
public string MapPath(string path) => Path.Combine(_webHostEnvironment.WebRootPath, path);
2020-02-18 08:32:06 +01:00
public string ToAbsolute(string virtualPath, string root) => throw new NotImplementedException();
public void LazyRestartApplication()
{
throw new NotImplementedException();
}
public void RegisterObject(IRegisteredObject registeredObject)
{
throw new NotImplementedException();
}
public void UnregisterObject(IRegisteredObject registeredObject)
{
throw new NotImplementedException();
}
}
}