Fixes issue with duplicate dictionary entries when wiring up property data
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -119,4 +119,5 @@ src/Umbraco.Web.UI.Client/bower_components/*
|
|||||||
/src/Umbraco.Web.UI/Umbraco/preview
|
/src/Umbraco.Web.UI/Umbraco/preview
|
||||||
|
|
||||||
#Ignore Rule for output of generated documentation files from Grunt docserve
|
#Ignore Rule for output of generated documentation files from Grunt docserve
|
||||||
src/Umbraco.Web.UI.Client/docs/api
|
src/Umbraco.Web.UI.Client/docs/api
|
||||||
|
src/*.boltdata/
|
||||||
|
|||||||
@@ -28,5 +28,23 @@ namespace Umbraco.Core.Models.Rdbms
|
|||||||
[NullSetting(NullSetting = NullSettings.Null)]
|
[NullSetting(NullSetting = NullSettings.Null)]
|
||||||
[Length(50)]
|
[Length(50)]
|
||||||
public string Alias { get; set; }
|
public string Alias { get; set; }
|
||||||
|
|
||||||
|
protected bool Equals(DataTypePreValueDto other)
|
||||||
|
{
|
||||||
|
return Id == other.Id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
if (ReferenceEquals(null, obj)) return false;
|
||||||
|
if (ReferenceEquals(this, obj)) return true;
|
||||||
|
if (obj.GetType() != this.GetType()) return false;
|
||||||
|
return Equals((DataTypePreValueDto) obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return Id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -292,15 +292,18 @@ namespace Umbraco.Core.Persistence.Repositories
|
|||||||
SortOrder = x.sortorder,
|
SortOrder = x.sortorder,
|
||||||
Value = x.value
|
Value = x.value
|
||||||
})
|
})
|
||||||
.ToDictionary(x => x.Alias, x => new PreValue(x.Id, x.Value, x.SortOrder));
|
.Distinct()
|
||||||
|
.ToArray();
|
||||||
|
|
||||||
var preVals = new PreValueCollection(preValData);
|
var asDictionary = preValData.ToDictionary(x => x.Alias, x => new PreValue(x.Id, x.Value, x.SortOrder));
|
||||||
|
|
||||||
var d = new ContentPropertyData(property.Value,
|
var preVals = new PreValueCollection(asDictionary);
|
||||||
|
|
||||||
|
var contentPropData = new ContentPropertyData(property.Value,
|
||||||
preVals,
|
preVals,
|
||||||
new Dictionary<string, object>());
|
new Dictionary<string, object>());
|
||||||
|
|
||||||
TagExtractor.SetPropertyTags(property, d, property.Value, tagSupport);
|
TagExtractor.SetPropertyTags(property, contentPropData, property.Value, tagSupport);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -386,15 +389,18 @@ namespace Umbraco.Core.Persistence.Repositories
|
|||||||
SortOrder = x.sortorder,
|
SortOrder = x.sortorder,
|
||||||
Value = x.value
|
Value = x.value
|
||||||
})
|
})
|
||||||
.ToDictionary(x => x.Alias, x => new PreValue(x.Id, x.Value, x.SortOrder));
|
.Distinct()
|
||||||
|
.ToArray();
|
||||||
|
|
||||||
|
var asDictionary = preValData.ToDictionary(x => x.Alias, x => new PreValue(x.Id, x.Value, x.SortOrder));
|
||||||
|
|
||||||
var preVals = new PreValueCollection(preValData);
|
var preVals = new PreValueCollection(asDictionary);
|
||||||
|
|
||||||
var d = new ContentPropertyData(property.Value,
|
var contentPropData = new ContentPropertyData(property.Value,
|
||||||
preVals,
|
preVals,
|
||||||
new Dictionary<string, object>());
|
new Dictionary<string, object>());
|
||||||
|
|
||||||
TagExtractor.SetPropertyTags(property, d, property.Value, tagSupport);
|
TagExtractor.SetPropertyTags(property, contentPropData, property.Value, tagSupport);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user