Fix ContentCultureInfos and collection
This commit is contained in:
@@ -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 />
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user