diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/ContentWrapper/ContentDataObject.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/ContentWrapper/ContentDataObject.cs index fcfc4af71..fc3eb86f1 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/ContentWrapper/ContentDataObject.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/ContentWrapper/ContentDataObject.cs @@ -98,7 +98,7 @@ namespace Squidex.Domain.Apps.Core.Scripting.ContentWrapper var propertyName = property.AsString(); - fieldProperties.GetOrAdd(propertyName, this, (k, c) => new ContentDataProperty(c)).Value = value; + fieldProperties.GetOrAdd(propertyName, (k, c) => new ContentDataProperty(c), this).Value = value; return true; } @@ -114,7 +114,7 @@ namespace Squidex.Domain.Apps.Core.Scripting.ContentWrapper return PropertyDescriptor.Undefined; } - return fieldProperties.GetOrAdd(propertyName, this, (k, c) => new ContentDataProperty(c, new ContentFieldObject(c, new ContentFieldData(), false))); + return fieldProperties.GetOrAdd(propertyName, (k, c) => new ContentDataProperty(c, new ContentFieldObject(c, new ContentFieldData(), false)), this); } public override IEnumerable> GetOwnProperties() diff --git a/backend/src/Squidex.Infrastructure/CollectionExtensions.cs b/backend/src/Squidex.Infrastructure/CollectionExtensions.cs index 3391fbe7d..79d704c2a 100644 --- a/backend/src/Squidex.Infrastructure/CollectionExtensions.cs +++ b/backend/src/Squidex.Infrastructure/CollectionExtensions.cs @@ -331,11 +331,11 @@ namespace Squidex.Infrastructure return dictionary.GetOrAdd(key, _ => new TValue()); } - public static TValue GetOrCreate(this IReadOnlyDictionary dictionary, TKey key, Func creator) where TKey : notnull + public static TValue GetOrCreate(this IReadOnlyDictionary dictionary, TKey key, Func valueFactory) where TKey : notnull { if (!dictionary.TryGetValue(key, out var result)) { - result = creator(key); + result = valueFactory(key); } return result; @@ -353,11 +353,11 @@ namespace Squidex.Infrastructure return result; } - public static TValue GetOrAdd(this IDictionary dictionary, TKey key, Func creator) where TKey : notnull + public static TValue GetOrAdd(this IDictionary dictionary, TKey key, Func valueFactory) where TKey : notnull { if (!dictionary.TryGetValue(key, out var result)) { - result = creator(key); + result = valueFactory(key); dictionary.Add(key, result); } @@ -365,11 +365,11 @@ namespace Squidex.Infrastructure return result; } - public static TValue GetOrAdd(this IDictionary dictionary, TKey key, TContext context, Func creator) where TKey : notnull + public static TValue GetOrAdd(this IDictionary dictionary, TKey key, Func valueFactory, TArg factoryArgument) where TKey : notnull { if (!dictionary.TryGetValue(key, out var result)) { - result = creator(key, context); + result = valueFactory(key, factoryArgument); dictionary.Add(key, result); } diff --git a/backend/src/Squidex.Infrastructure/Orleans/ActivationLimiter.cs b/backend/src/Squidex.Infrastructure/Orleans/ActivationLimiter.cs index 4fb01c4ab..bb05a8edb 100644 --- a/backend/src/Squidex.Infrastructure/Orleans/ActivationLimiter.cs +++ b/backend/src/Squidex.Infrastructure/Orleans/ActivationLimiter.cs @@ -55,7 +55,7 @@ namespace Squidex.Infrastructure.Orleans public void Register(Type grainType, IDeactivater deactivater, int maxActivations) { - var byType = instances.GetOrAdd(grainType, maxActivations, (t, a) => new LastUsedInstances(a)); + var byType = instances.GetOrAdd(grainType, (t, a) => new LastUsedInstances(a), maxActivations); byType.Register(deactivater); }