Fixes N+1 Issues caused by the new bypass start nodes changes
This commit is contained in:
@@ -22,8 +22,10 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
[Required]
|
||||
public int Id { get; set; }
|
||||
|
||||
[DataMember(Name = "dataTypeId", IsRequired = false)]
|
||||
public Guid? DataTypeId { get; set; }
|
||||
//fixme: This name dataTypeId is inconsistent, but requires us to change it everywhere in angular
|
||||
[DataMember(Name = "dataTypeId", IsRequired = false)]
|
||||
[ReadOnly(true)]
|
||||
public Guid DataTypeKey { get; set; }
|
||||
|
||||
[DataMember(Name = "value")]
|
||||
public object Value { get; set; }
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
@@ -43,6 +44,10 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
[Required]
|
||||
public int DataTypeId { get; set; }
|
||||
|
||||
[DataMember(Name = "dataTypeKey")]
|
||||
[ReadOnly(true)]
|
||||
public Guid DataTypeKey { get; set; }
|
||||
|
||||
//SD: Is this really needed ?
|
||||
[DataMember(Name = "groupId")]
|
||||
public int GroupId { get; set; }
|
||||
|
||||
@@ -50,13 +50,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
dest.Alias = property.Alias;
|
||||
dest.PropertyEditor = editor;
|
||||
dest.Editor = editor.Alias;
|
||||
|
||||
//fixme: although this might get cached, if a content item has 100 properties of different data types, then this means this is going to be 100 extra DB queries :( :( :(
|
||||
// - ideally, we'd just have the DataTypeKey alongside the DataTypeId which is loaded in the single sql statement which should be relatively easy.
|
||||
var dataTypeKey = _entityService.GetKey(property.PropertyType.DataTypeId, UmbracoObjectTypes.DataType);
|
||||
if (!dataTypeKey.Success)
|
||||
throw new InvalidOperationException("Can't get the unique key from the id: " + property.PropertyType.DataTypeId);
|
||||
dest.DataTypeId = dataTypeKey.Result;
|
||||
dest.DataTypeKey = property.PropertyType.DataTypeKey;
|
||||
|
||||
// if there's a set of property aliases specified, we will check if the current property's value should be mapped.
|
||||
// if it isn't one of the ones specified in 'includeProperties', we will just return the result without mapping the Value.
|
||||
|
||||
@@ -219,6 +219,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
{
|
||||
target.Name = source.Label;
|
||||
target.DataTypeId = source.DataTypeId;
|
||||
target.DataTypeKey = source.DataTypeKey;
|
||||
target.Mandatory = source.Validation.Mandatory;
|
||||
target.ValidationRegExp = source.Validation.Pattern;
|
||||
target.Variations = source.AllowCultureVariant ? ContentVariation.Culture : ContentVariation.Nothing;
|
||||
@@ -334,6 +335,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
target.Alias = source.Alias;
|
||||
target.AllowCultureVariant = source.AllowCultureVariant;
|
||||
target.DataTypeId = source.DataTypeId;
|
||||
target.DataTypeKey = source.DataTypeKey;
|
||||
target.Description = source.Description;
|
||||
target.GroupId = source.GroupId;
|
||||
target.Id = source.Id;
|
||||
@@ -349,6 +351,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
target.Alias = source.Alias;
|
||||
target.AllowCultureVariant = source.AllowCultureVariant;
|
||||
target.DataTypeId = source.DataTypeId;
|
||||
target.DataTypeKey = source.DataTypeKey;
|
||||
target.Description = source.Description;
|
||||
target.GroupId = source.GroupId;
|
||||
target.Id = source.Id;
|
||||
|
||||
@@ -231,6 +231,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
GroupId = groupId,
|
||||
Inherited = inherited,
|
||||
DataTypeId = p.DataTypeId,
|
||||
DataTypeKey = p.DataTypeKey,
|
||||
SortOrder = p.SortOrder,
|
||||
ContentTypeId = contentType.Id,
|
||||
ContentTypeName = contentType.Name,
|
||||
|
||||
Reference in New Issue
Block a user