// ========================================================================== // Squidex Headless CMS // ========================================================================== // Copyright (c) Squidex UG (haftungsbeschraenkt) // All rights reserved. Licensed under the MIT license. // ========================================================================== using System.Collections.Concurrent; namespace TestSuite { public static class Factories { private static readonly ConcurrentDictionary> Instances = new ConcurrentDictionary>(); public static async Task CreateAsync(string key, Func> factory) { return (T)await Instances.GetOrAdd(key, async (_, f) => await f(), factory); } } }