* Move MapPathWebRoot & MapPathContentRoot to extension methods. * Set AspNetCoreHostingEnvironment ApplicationId without service provider. * Drop some usages of TempHostingEnvironment * Logging setup cleanup - AppDomainId has no value (it is always "1") Creating new AppDomains isn't possible in .Net core. Attempting to do so results in a platform exception. A dotnet core process has a single AppDomain instance whose Id property is always the integer 1. * Setup logging without IHostingEnvironment * Mark IUmbracoBuilder.BuilderHostingEnvironment obsolete And remove internal usages. * Typeloader no longer uses umbraco-types.list * Added UmbracoHost - setup serilog two-stage init. * Add ApplicationIdEnricher * Defensive tweaks for those not using UmbracoHost * Drop UmbracoHost static class * Setup runtime logger without host builder extensions. * Prevent RefreshingRazorViewEngine related explosions * Filescoped namespaces for new classes. * Apply suggestions from code review
36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
using System;
|
|
using Microsoft.AspNetCore.DataProtection.Infrastructure;
|
|
using Umbraco.Extensions;
|
|
|
|
namespace Umbraco.Cms.Web.Common.Extensions
|
|
{
|
|
/// <summary>
|
|
/// Contains extension methods for the <see cref="IApplicationDiscriminator" /> interface.
|
|
/// </summary>
|
|
public static class ApplicationDiscriminatorExtensions
|
|
{
|
|
private static string s_applicationId;
|
|
|
|
/// <summary>
|
|
/// Gets an application id which respects downstream customizations.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Hashed to obscure any unintended infrastructure details e.g. the default value is ContentRootPath.
|
|
/// </remarks>
|
|
public static string GetApplicationId(this IApplicationDiscriminator applicationDiscriminator)
|
|
{
|
|
if (s_applicationId != null)
|
|
{
|
|
return s_applicationId;
|
|
}
|
|
|
|
if (applicationDiscriminator == null)
|
|
{
|
|
throw new ArgumentNullException(nameof(applicationDiscriminator));
|
|
}
|
|
|
|
return s_applicationId = applicationDiscriminator.Discriminator.GenerateHash();
|
|
}
|
|
}
|
|
}
|