Fix ContentCultureInfos and collection

This commit is contained in:
Stephan
2018-10-26 12:36:59 +02:00
parent 0cb19e0dbd
commit 45cb56b96c
2 changed files with 10 additions and 6 deletions

View File

@@ -28,11 +28,11 @@ namespace Umbraco.Core.Models
/// Initializes a new instance of the <see cref="ContentCultureInfos"/> class.
/// </summary>
/// <remarks>Used for cloning, without change tracking.</remarks>
private ContentCultureInfos(string culture, string name, DateTime date)
: this(culture)
internal ContentCultureInfos(ContentCultureInfos other)
: this(other.Culture)
{
_name = name;
_date = date;
_name = other.Name;
_date = other.Date;
}
/// <summary>
@@ -61,7 +61,7 @@ namespace Umbraco.Core.Models
/// <inheritdoc />
public object DeepClone()
{
return new ContentCultureInfos(Culture, Name, Date);
return new ContentCultureInfos(this);
}
/// <inheritdoc />

View File

@@ -24,8 +24,12 @@ namespace Umbraco.Core.Models
public ContentCultureInfosCollection(IEnumerable<ContentCultureInfos> items)
: base(x => x.Culture, StringComparer.InvariantCultureIgnoreCase)
{
// make sure to add *copies* and not the original items,
// as items can be modified by AddOrUpdate, and therefore
// the new collection would be impacted by changes made
// to the old collection
foreach (var item in items)
Add(item);
Add(new ContentCultureInfos(item));
}
/// <summary>