Got models pulled apart and simplified, much less inheritance and easier to follow, start wiring up the model binding logic for content along with validation for each variant

This commit is contained in:
Shannon
2018-08-01 16:46:13 +10:00
parent c073ab2731
commit 6a94694f16
28 changed files with 197 additions and 226 deletions

View File

@@ -0,0 +1,28 @@
using AutoMapper;
namespace Umbraco.Web.Models.Mapping
{
/// <summary>
/// Extension methods for AutoMapper's <see cref="ResolutionContext"/>
/// </summary>
internal static class ResolutionContextExtensions
{
public const string CultureKey = "ContextMapper.Culture";
/// <summary>
/// Returns the language Id in the mapping context if one is found
/// </summary>
/// <param name="resolutionContext"></param>
/// <returns></returns>
public static string GetCulture(this ResolutionContext resolutionContext)
{
if (!resolutionContext.Options.Items.TryGetValue(CultureKey, out var obj)) return null;
if (obj is string s)
return s;
return null;
}
}
}