Removes the need to do any lookup for GetNonGroupedProperties, we already know if they belong to a non-group based on the ID

This commit is contained in:
Shannon
2019-02-07 14:01:00 +11:00
parent 03eaf3aa3d
commit a9045c254e
4 changed files with 12 additions and 19 deletions

View File

@@ -29,8 +29,8 @@ namespace Umbraco.Web.Models.Mapping
private readonly IMemberService _memberService;
private readonly IUserService _userService;
public MemberTabsAndPropertiesResolver(IUmbracoContextAccessor umbracoContextAccessor, ILocalizedTextService localizedTextService, IMemberService memberService, IUserService userService, IMemberTypeService memberTypeService, IContentTypeBaseServiceProvider contentTypeServiceProvider)
: base(localizedTextService, contentTypeServiceProvider)
public MemberTabsAndPropertiesResolver(IUmbracoContextAccessor umbracoContextAccessor, ILocalizedTextService localizedTextService, IMemberService memberService, IUserService userService, IMemberTypeService memberTypeService)
: base(localizedTextService)
{
_umbracoContextAccessor = umbracoContextAccessor ?? throw new ArgumentNullException(nameof(umbracoContextAccessor));
_localizedTextService = localizedTextService ?? throw new ArgumentNullException(nameof(localizedTextService));

View File

@@ -12,19 +12,17 @@ namespace Umbraco.Web.Models.Mapping
{
internal abstract class TabsAndPropertiesResolver
{
private readonly IContentTypeBaseServiceProvider _contentTypeServiceProvider;
protected ILocalizedTextService LocalizedTextService { get; }
protected IEnumerable<string> IgnoreProperties { get; set; }
protected TabsAndPropertiesResolver(ILocalizedTextService localizedTextService, IContentTypeBaseServiceProvider contentTypeServiceProvider)
protected TabsAndPropertiesResolver(ILocalizedTextService localizedTextService)
{
_contentTypeServiceProvider = contentTypeServiceProvider;
LocalizedTextService = localizedTextService ?? throw new ArgumentNullException(nameof(localizedTextService));
IgnoreProperties = new List<string>();
}
protected TabsAndPropertiesResolver(ILocalizedTextService localizedTextService, IContentTypeBaseServiceProvider contentTypeServiceProvider, IEnumerable<string> ignoreProperties)
: this(localizedTextService, contentTypeServiceProvider)
protected TabsAndPropertiesResolver(ILocalizedTextService localizedTextService, IEnumerable<string> ignoreProperties)
: this(localizedTextService)
{
IgnoreProperties = ignoreProperties ?? throw new ArgumentNullException(nameof(ignoreProperties));
}
@@ -52,7 +50,7 @@ namespace Umbraco.Web.Models.Mapping
{
// add the generic properties tab, for properties that don't belong to a tab
// get the properties, map and translate them, then add the tab
var noGroupProperties = content.GetNonGroupedProperties(_contentTypeServiceProvider)
var noGroupProperties = content.GetNonGroupedProperties()
.Where(x => IgnoreProperties.Contains(x.Alias) == false) // skip ignored
.ToList();
var genericproperties = MapProperties(content, noGroupProperties, context);
@@ -124,8 +122,8 @@ namespace Umbraco.Web.Models.Mapping
internal class TabsAndPropertiesResolver<TSource, TDestination> : TabsAndPropertiesResolver, IValueResolver<TSource, TDestination, IEnumerable<Tab<ContentPropertyDisplay>>>
where TSource : IContentBase
{
public TabsAndPropertiesResolver(ILocalizedTextService localizedTextService, IContentTypeBaseServiceProvider contentTypeServiceProvider)
: base(localizedTextService, contentTypeServiceProvider)
public TabsAndPropertiesResolver(ILocalizedTextService localizedTextService)
: base(localizedTextService)
{ }
public virtual IEnumerable<Tab<ContentPropertyDisplay>> Resolve(TSource source, TDestination destination, IEnumerable<Tab<ContentPropertyDisplay>> destMember, ResolutionContext context)