U4-11227 - default variations and fallback (wip)

This commit is contained in:
Stephan
2018-04-18 19:46:47 +02:00
parent 8873fa9dd4
commit 908589277a
52 changed files with 590 additions and 228 deletions

View File

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