Merge remote-tracking branch 'origin/v8/8.16' into v9/feature/merge_v8_11082021

# Conflicts:
#	.github/CONTRIBUTING.md
#	build/NuSpecs/UmbracoCms.Core.nuspec
#	build/NuSpecs/UmbracoCms.Web.nuspec
#	build/NuSpecs/UmbracoCms.nuspec
#	src/SolutionInfo.cs
#	src/Umbraco.Core/Cache/AppCaches.cs
#	src/Umbraco.Core/Cache/AppPolicedCacheDictionary.cs
#	src/Umbraco.Core/Cache/DeepCloneAppCache.cs
#	src/Umbraco.Core/Cache/WebCachingAppCache.cs
#	src/Umbraco.Core/CompositionExtensions.cs
#	src/Umbraco.Core/Models/Identity/BackOfficeIdentityUser.cs
#	src/Umbraco.Core/Models/PropertyGroupCollection.cs
#	src/Umbraco.Core/Models/PropertyTypeCollection.cs
#	src/Umbraco.Core/Persistence/Repositories/Implement/ExternalLoginRepository.cs
#	src/Umbraco.Core/ReadLock.cs
#	src/Umbraco.Core/Routing/SiteDomainMapper.cs
#	src/Umbraco.Core/UpgradeableReadLock.cs
#	src/Umbraco.Core/WriteLock.cs
#	src/Umbraco.Examine/ExamineExtensions.cs
#	src/Umbraco.Infrastructure/Examine/UmbracoFieldDefinitionCollection.cs
#	src/Umbraco.Infrastructure/Persistence/Dtos/ContentTypeDto.cs
#	src/Umbraco.Infrastructure/Persistence/Dtos/DictionaryDto.cs
#	src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MemberGroupRepository.cs
#	src/Umbraco.Infrastructure/Persistence/Repositories/Implement/TemplateRepository.cs
#	src/Umbraco.Infrastructure/Persistence/Repositories/Implement/UserRepository.cs
#	src/Umbraco.Infrastructure/Services/IdKeyMap.cs
#	src/Umbraco.Infrastructure/Services/Implement/ContentService.cs
#	src/Umbraco.ModelsBuilder.Embedded/PureLiveModelFactory.cs
#	src/Umbraco.Tests/App.config
#	src/Umbraco.Web.BackOffice/Controllers/EntityController.cs
#	src/Umbraco.Web.UI.Client/package.json
#	src/Umbraco.Web.UI.NetCore/umbraco/config/lang/da.xml
#	src/Umbraco.Web.UI.NetCore/umbraco/config/lang/en.xml
#	src/Umbraco.Web.UI.NetCore/umbraco/config/lang/en_us.xml
#	src/Umbraco.Web.UI/Umbraco.Web.UI.csproj
#	src/Umbraco.Web.UI/Umbraco/config/lang/cy.xml
#	src/Umbraco.Web.UI/web.Template.config
#	src/Umbraco.Web/CacheHelperExtensions.cs
#	src/Umbraco.Web/Editors/RelationTypeController.cs
#	src/Umbraco.Web/Logging/WebProfilerProvider.cs
#	src/Umbraco.Web/Models/Mapping/MemberMapDefinition.cs
#	src/Umbraco.Web/PublishedCache/NuCache/MemberCache.cs
#	src/Umbraco.Web/Routing/ContentFinderByConfigured404.cs
#	src/Umbraco.Web/Routing/NotFoundHandlerHelper.cs
#	src/Umbraco.Web/Security/BackOfficeUserManager.cs
#	src/Umbraco.Web/Umbraco.Web.csproj
This commit is contained in:
Bjarke Berg
2021-08-11 19:11:35 +02:00
138 changed files with 1210 additions and 1094 deletions

View File

@@ -4,7 +4,6 @@ using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Linq;
using System.Runtime.Serialization;
using System.Threading;
namespace Umbraco.Cms.Core.Models
{
@@ -17,8 +16,6 @@ namespace Umbraco.Cms.Core.Models
// TODO: Change this to ObservableDictionary so we can reduce the INotifyCollectionChanged implementation details
public class PropertyGroupCollection : KeyedCollection<string, PropertyGroup>, INotifyCollectionChanged, IDeepCloneable
{
private readonly ReaderWriterLockSlim _addLocker = new ReaderWriterLockSlim();
public PropertyGroupCollection()
{ }
@@ -70,47 +67,37 @@ namespace Umbraco.Cms.Core.Models
public new void Add(PropertyGroup item)
{
try
//Note this is done to ensure existing groups can be renamed
if (item.HasIdentity && item.Id > 0)
{
_addLocker.EnterWriteLock();
//Note this is done to ensure existing groups can be renamed
if (item.HasIdentity && item.Id > 0)
var exists = Contains(item.Id);
if (exists)
{
var exists = Contains(item.Id);
var keyExists = Contains(item.Name);
if (keyExists)
throw new Exception($"Naming conflict: Changing the name of PropertyGroup '{item.Name}' would result in duplicates");
//collection events will be raised in SetItem
SetItem(IndexOfKey(item.Id), item);
return;
}
}
else
{
var key = GetKeyForItem(item);
if (key != null)
{
var exists = Contains(key);
if (exists)
{
var keyExists = Contains(item.Name);
if (keyExists)
throw new Exception($"Naming conflict: Changing the name of PropertyGroup '{item.Name}' would result in duplicates");
//collection events will be raised in SetItem
SetItem(IndexOfKey(item.Id), item);
SetItem(IndexOfKey(key), item);
return;
}
}
else
{
var key = GetKeyForItem(item);
if (key != null)
{
var exists = Contains(key);
if (exists)
{
//collection events will be raised in SetItem
SetItem(IndexOfKey(key), item);
return;
}
}
}
//collection events will be raised in InsertItem
base.Add(item);
}
finally
{
if (_addLocker.IsWriteLockHeld)
_addLocker.ExitWriteLock();
}
//collection events will be raised in InsertItem
base.Add(item);
}
/// <summary>