using System; using System.Collections.Concurrent; using System.Threading; namespace Umbraco.Core.Models.PublishedContent { /// /// Provides a CurrentUICulture-based implementation of . /// /// /// This accessor does not support segments. There is no need to set the current context. /// public class ThreadCulturePublishedVariationContextAccessor : IPublishedVariationContextAccessor { private readonly ConcurrentDictionary _contexts = new ConcurrentDictionary(); public PublishedVariationContext Context { get => _contexts.GetOrAdd(Thread.CurrentThread.CurrentUICulture.Name, culture => new PublishedVariationContext { Culture = culture }); set => throw new NotSupportedException(); } } }