Fixes issue with duplicate dictionary entries when wiring up property data
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -120,3 +120,4 @@ src/Umbraco.Web.UI.Client/bower_components/*
|
||||
|
||||
#Ignore Rule for output of generated documentation files from Grunt docserve
|
||||
src/Umbraco.Web.UI.Client/docs/api
|
||||
src/*.boltdata/
|
||||
|
||||
@@ -28,5 +28,23 @@ namespace Umbraco.Core.Models.Rdbms
|
||||
[NullSetting(NullSetting = NullSettings.Null)]
|
||||
[Length(50)]
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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