diff --git a/.gitignore b/.gitignore index 7ee06c2c7f..e8a3ef1790 100644 --- a/.gitignore +++ b/.gitignore @@ -119,4 +119,5 @@ src/Umbraco.Web.UI.Client/bower_components/* /src/Umbraco.Web.UI/Umbraco/preview #Ignore Rule for output of generated documentation files from Grunt docserve -src/Umbraco.Web.UI.Client/docs/api \ No newline at end of file +src/Umbraco.Web.UI.Client/docs/api +src/*.boltdata/ diff --git a/src/Umbraco.Core/Models/Rdbms/DataTypePreValueDto.cs b/src/Umbraco.Core/Models/Rdbms/DataTypePreValueDto.cs index 54f049fef9..ad0b915363 100644 --- a/src/Umbraco.Core/Models/Rdbms/DataTypePreValueDto.cs +++ b/src/Umbraco.Core/Models/Rdbms/DataTypePreValueDto.cs @@ -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; + } } } \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Repositories/VersionableRepositoryBase.cs b/src/Umbraco.Core/Persistence/Repositories/VersionableRepositoryBase.cs index 6b6b453f48..1c75759f5b 100644 --- a/src/Umbraco.Core/Persistence/Repositories/VersionableRepositoryBase.cs +++ b/src/Umbraco.Core/Persistence/Repositories/VersionableRepositoryBase.cs @@ -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()); - 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 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, new Dictionary()); - TagExtractor.SetPropertyTags(property, d, property.Value, tagSupport); + TagExtractor.SetPropertyTags(property, contentPropData, property.Value, tagSupport); } }