From 5f6ad4f0a5244e41412cc0ca7b6040d5829e5ed5 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sun, 24 Oct 2021 18:59:00 +0200 Subject: [PATCH] Fix naming. --- .../Migrations/OldEvents/AppPatternAdded.cs | 2 +- .../Migrations/OldEvents/AppPatternUpdated.cs | 2 +- .../OldTriggers/ContentChangedTrigger.cs | 4 +-- .../Apps/AppClients.cs | 2 +- .../Apps/AppContributors.cs | 2 +- .../Apps/AppSettings.cs | 4 +-- .../Apps/Json/LanguageConfigSurrogate.cs | 2 +- .../Apps/LanguageConfig.cs | 6 ++--- .../Apps/LanguagesConfig.cs | 2 +- .../Apps/Roles.cs | 16 ++++++------ .../Contents/Json/WorkflowStepSurrogate.cs | 2 +- .../Contents/NoUpdate.cs | 2 +- .../Contents/Workflow.cs | 16 ++++++------ .../Contents/WorkflowCondition.cs | 2 +- .../Contents/WorkflowStep.cs | 4 +-- .../Contents/WorkflowTransition.cs | 2 +- .../Contents/Workflows.cs | 2 +- .../Rules/Triggers/ContentChangedTriggerV2.cs | 2 +- .../Schemas/ArrayFieldProperties.cs | 2 +- .../Schemas/AssetsFieldProperties.cs | 6 ++--- .../Schemas/ComponentFieldProperties.cs | 4 +-- .../Schemas/ComponentsFieldProperties.cs | 6 ++--- .../Schemas/FieldExtensions.cs | 2 +- .../Schemas/FieldNames.cs | 2 +- .../Schemas/FieldProperties.cs | 2 +- .../Schemas/FieldRules.cs | 2 +- .../Schemas/Json/SchemaSurrogate.cs | 2 +- .../Schemas/LocalizedValue.cs | 2 +- .../Schemas/NumberFieldProperties.cs | 2 +- .../Schemas/ReferencesFieldProperties.cs | 8 +++--- .../Schemas/ResolvedComponents.cs | 2 +- .../Schemas/Schema.cs | 6 ++--- .../Schemas/SchemaProperties.cs | 2 +- .../Schemas/StringFieldProperties.cs | 2 +- .../Schemas/TagsFieldProperties.cs | 6 ++--- .../GenerateJsonSchema/JsonTypeVisitor.cs | 2 +- .../ValidateContent/JsonValueConverter.cs | 4 +-- .../AppProviderExtensions.cs | 2 +- .../Apps/Templates/CreateProfile.cs | 2 +- .../Types/Contents/ComponentUnionGraphType.cs | 2 +- .../GraphQL/Types/Contents/FieldVisitor.cs | 4 +-- .../Types/Contents/ReferenceUnionGraphType.cs | 2 +- .../Schemas/Commands/ConfigurePreviewUrls.cs | 2 +- .../Schemas/Commands/CreateSchema.cs | 2 +- .../Schemas/Commands/IUpsertCommand.cs | 2 +- .../Schemas/Commands/SynchronizeSchema.cs | 2 +- .../Schemas/SchemaPreviewUrlsConfigured.cs | 2 +- ...bleDictionary.cs => ReadonlyDictionary.cs} | 18 ++++++------- ....cs => ReadonlyDictionary{TKey,TValue}.cs} | 10 +++---- .../{ImmutableList.cs => ReadonlyList.cs} | 14 +++++----- ...ImmutableList{T}.cs => ReadonlyList{T}.cs} | 10 +++---- .../Queries/PropertyPath.cs | 2 +- .../Security/PermissionSet.cs | 2 +- .../Api/Config/OpenApi/ReflectionServices.cs | 4 +-- .../Apps/Models/UpdateAppSettingsDto.cs | 4 +-- .../Apps/Models/UpdateWorkflowDto.cs | 4 +-- .../Controllers/Apps/Models/WorkflowDto.cs | 2 +- .../Apps/Models/WorkflowStepDto.cs | 2 +- .../Assets/AssetFoldersController.cs | 2 +- .../Triggers/ContentChangedRuleTriggerDto.cs | 2 +- .../Schemas/Models/ConfigurePreviewUrlsDto.cs | 2 +- .../Schemas/Models/FieldPropertiesDto.cs | 2 +- .../Models/Fields/ArrayFieldPropertiesDto.cs | 2 +- .../Models/Fields/AssetsFieldPropertiesDto.cs | 6 ++--- .../Fields/ComponentFieldPropertiesDto.cs | 2 +- .../Fields/ComponentsFieldPropertiesDto.cs | 4 +-- .../Models/Fields/NumberFieldPropertiesDto.cs | 2 +- .../Fields/ReferencesFieldPropertiesDto.cs | 6 ++--- .../Models/Fields/StringFieldPropertiesDto.cs | 2 +- .../Models/Fields/TagsFieldPropertiesDto.cs | 6 ++--- .../Controllers/Schemas/Models/SchemaDto.cs | 2 +- .../Schemas/Models/SchemaPropertiesDto.cs | 2 +- .../Schemas/Models/UpdateSchemaDto.cs | 2 +- .../Schemas/Models/UpsertSchemaDto.cs | 2 +- .../src/Squidex/Config/Domain/AppsServices.cs | 2 +- .../Model/Apps/LanguagesConfigTests.cs | 6 ++--- .../Model/Contents/WorkflowJsonTests.cs | 6 ++--- .../Model/Contents/WorkflowTests.cs | 4 +-- .../Model/Schemas/FieldCompareTests.cs | 8 +++--- .../Model/Schemas/SchemaTests.cs | 6 ++--- .../DefaultValues/DefaultValuesTests.cs | 18 ++++++------- .../SchemaSynchronizerTests.cs | 2 +- .../ValidateContent/ArrayFieldTests.cs | 4 +-- .../ValidateContent/ComponentFieldTests.cs | 2 +- .../ValidateContent/ComponentsFieldTests.cs | 4 +-- .../ValidateContent/NumberFieldTests.cs | 2 +- .../ValidateContent/StringFieldTests.cs | 2 +- .../ValidateContent/TagsFieldTests.cs | 2 +- .../Validators/AssetsValidatorTests.cs | 2 +- .../TestHelpers/TestUtils.cs | 2 +- .../Apps/DomainObject/Guards/GuardAppTests.cs | 12 ++++----- .../Guards/GuardAppWorkflowTests.cs | 16 ++++++------ .../ContentChangedTriggerHandlerTests.cs | 4 +-- .../DefaultWorkflowsValidatorTests.cs | 10 +++---- .../Contents/DynamicContentWorkflowTests.cs | 16 ++++++------ .../Contents/GraphQL/TestSchemas.cs | 2 +- .../DomainObject/Guards/GuardRuleTests.cs | 6 ++--- .../Triggers/ContentChangedTriggerTests.cs | 8 +++--- .../NumberFieldPropertiesTests.cs | 4 +-- .../StringFieldPropertiesTests.cs | 4 +-- .../DomainObject/Guards/GuardSchemaTests.cs | 2 +- .../DomainObject/SchemaDomainObjectTests.cs | 2 +- .../Schemas/SchemaCommandsTests.cs | 4 +-- ...aryTests.cs => ReadonlyDictionaryTests.cs} | 26 +++++++++---------- ...tableListTests.cs => ReadonlyListTests.cs} | 24 ++++++++--------- 105 files changed, 245 insertions(+), 245 deletions(-) rename backend/src/Squidex.Infrastructure/Collections/{ImmutableDictionary.cs => ReadonlyDictionary.cs} (56%) rename backend/src/Squidex.Infrastructure/Collections/{ImmutableDictionary{TKey,TValue}.cs => ReadonlyDictionary{TKey,TValue}.cs} (85%) rename backend/src/Squidex.Infrastructure/Collections/{ImmutableList.cs => ReadonlyList.cs} (70%) rename backend/src/Squidex.Infrastructure/Collections/{ImmutableList{T}.cs => ReadonlyList{T}.cs} (77%) rename backend/tests/Squidex.Infrastructure.Tests/Collections/{ImmutableDictionaryTests.cs => ReadonlyDictionaryTests.cs} (78%) rename backend/tests/Squidex.Infrastructure.Tests/Collections/{ImmutableListTests.cs => ReadonlyListTests.cs} (71%) diff --git a/backend/src/Migrations/OldEvents/AppPatternAdded.cs b/backend/src/Migrations/OldEvents/AppPatternAdded.cs index bbebb7b7a..9462d3660 100644 --- a/backend/src/Migrations/OldEvents/AppPatternAdded.cs +++ b/backend/src/Migrations/OldEvents/AppPatternAdded.cs @@ -36,7 +36,7 @@ namespace Migrations.OldEvents { var newSettings = new AppSettings { - Patterns = ImmutableList.ToImmutableList(new List(state.Settings.Patterns.Where(x => x.Name != Name || x.Regex != Pattern)) + Patterns = ReadonlyList.ToReadonlyList(new List(state.Settings.Patterns.Where(x => x.Name != Name || x.Regex != Pattern)) { new Pattern(Name, Pattern) { diff --git a/backend/src/Migrations/OldEvents/AppPatternUpdated.cs b/backend/src/Migrations/OldEvents/AppPatternUpdated.cs index d9dd0e172..b0c363f15 100644 --- a/backend/src/Migrations/OldEvents/AppPatternUpdated.cs +++ b/backend/src/Migrations/OldEvents/AppPatternUpdated.cs @@ -36,7 +36,7 @@ namespace Migrations.OldEvents { var newSettings = new AppSettings { - Patterns = ImmutableList.ToImmutableList(new List(state.Settings.Patterns.Where(x => x.Name != Name || x.Regex != Pattern)) + Patterns = ReadonlyList.ToReadonlyList(new List(state.Settings.Patterns.Where(x => x.Name != Name || x.Regex != Pattern)) { new Pattern(Name, Pattern) { diff --git a/backend/src/Migrations/OldTriggers/ContentChangedTrigger.cs b/backend/src/Migrations/OldTriggers/ContentChangedTrigger.cs index 5f08eafc3..690f2242c 100644 --- a/backend/src/Migrations/OldTriggers/ContentChangedTrigger.cs +++ b/backend/src/Migrations/OldTriggers/ContentChangedTrigger.cs @@ -18,7 +18,7 @@ namespace Migrations.OldTriggers [TypeName(nameof(ContentChangedTrigger))] public sealed record ContentChangedTrigger : RuleTrigger, IMigrated { - public ImmutableList Schemas { get; set; } + public ReadonlyList Schemas { get; set; } public bool HandleAll { get; set; } @@ -29,7 +29,7 @@ namespace Migrations.OldTriggers public RuleTrigger Migrate() { - var schemas = Schemas.Select(x => x.Migrate()).ToImmutableList(); + var schemas = Schemas.Select(x => x.Migrate()).ToReadonlyList(); return new ContentChangedTriggerV2 { HandleAll = HandleAll, Schemas = schemas }; } diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppClients.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppClients.cs index 1128e2f63..0933ff08c 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppClients.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppClients.cs @@ -12,7 +12,7 @@ using Squidex.Infrastructure.Collections; namespace Squidex.Domain.Apps.Core.Apps { - public sealed class AppClients : ImmutableDictionary + public sealed class AppClients : ReadonlyDictionary { public static readonly AppClients Empty = new AppClients(); diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppContributors.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppContributors.cs index f1e0e74cd..789393c92 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppContributors.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppContributors.cs @@ -12,7 +12,7 @@ using Squidex.Infrastructure.Collections; namespace Squidex.Domain.Apps.Core.Apps { - public sealed class AppContributors : ImmutableDictionary + public sealed class AppContributors : ReadonlyDictionary { public static readonly AppContributors Empty = new AppContributors(); diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppSettings.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppSettings.cs index 6eff41ddb..39bafc062 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppSettings.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppSettings.cs @@ -13,9 +13,9 @@ namespace Squidex.Domain.Apps.Core.Apps { public static readonly AppSettings Empty = new AppSettings(); - public ImmutableList Patterns { get; init; } = ImmutableList.Empty(); + public ReadonlyList Patterns { get; init; } = ReadonlyList.Empty(); - public ImmutableList Editors { get; init; } = ImmutableList.Empty(); + public ReadonlyList Editors { get; init; } = ReadonlyList.Empty(); public bool HideScheduler { get; init; } diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/Json/LanguageConfigSurrogate.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/Json/LanguageConfigSurrogate.cs index 0f49d5383..be1248765 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/Json/LanguageConfigSurrogate.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/Json/LanguageConfigSurrogate.cs @@ -32,7 +32,7 @@ namespace Squidex.Domain.Apps.Core.Apps.Json } else { - return new LanguageConfig(IsOptional, ImmutableList.Create(Fallback)); + return new LanguageConfig(IsOptional, ReadonlyList.Create(Fallback)); } } } diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/LanguageConfig.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/LanguageConfig.cs index e6a465833..059cb43e5 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/LanguageConfig.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/LanguageConfig.cs @@ -18,9 +18,9 @@ namespace Squidex.Domain.Apps.Core.Apps public bool IsOptional { get; } - public ImmutableList Fallbacks { get; } = ImmutableList.Empty(); + public ReadonlyList Fallbacks { get; } = ReadonlyList.Empty(); - public LanguageConfig(bool isOptional = false, ImmutableList? fallbacks = null) + public LanguageConfig(bool isOptional = false, ReadonlyList? fallbacks = null) { IsOptional = isOptional; @@ -34,7 +34,7 @@ namespace Squidex.Domain.Apps.Core.Apps { if (Fallbacks.Any(x => x.Iso2Code == self) || Fallbacks.Any(x => !allowed.ContainsKey(x))) { - var cleaned = Fallbacks.Where(x => x.Iso2Code != self && allowed.ContainsKey(x.Iso2Code)).ToImmutableList(); + var cleaned = Fallbacks.Where(x => x.Iso2Code != self && allowed.ContainsKey(x.Iso2Code)).ToReadonlyList(); return new LanguageConfig(IsOptional, cleaned); } diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/LanguagesConfig.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/LanguagesConfig.cs index d92bf87d7..95f719fff 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/LanguagesConfig.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/LanguagesConfig.cs @@ -67,7 +67,7 @@ namespace Squidex.Domain.Apps.Core.Apps var newLanguages = new Dictionary(languages) { - [language] = new LanguageConfig(isOptional, ImmutableList.Create(fallbacks)) + [language] = new LanguageConfig(isOptional, ReadonlyList.Create(fallbacks)) }; return Build(newLanguages, master); diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/Roles.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/Roles.cs index 0200a0159..4659bf653 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/Roles.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/Roles.cs @@ -20,7 +20,7 @@ namespace Squidex.Domain.Apps.Core.Apps { public sealed class Roles { - private readonly ImmutableDictionary inner; + private readonly ReadonlyDictionary inner; public static readonly IReadOnlyDictionary Defaults = new Dictionary { @@ -57,7 +57,7 @@ namespace Squidex.Domain.Apps.Core.Apps JsonValue.Object()) }; - public static readonly Roles Empty = new Roles(new ImmutableDictionary()); + public static readonly Roles Empty = new Roles(new ReadonlyDictionary()); public int CustomCount { @@ -79,14 +79,14 @@ namespace Squidex.Domain.Apps.Core.Apps get => inner.Values.Union(Defaults.Values); } - private Roles(ImmutableDictionary roles) + private Roles(ReadonlyDictionary roles) { inner = roles; } public Roles(Dictionary roles) { - inner = new ImmutableDictionary(Cleaned(roles)); + inner = new ReadonlyDictionary(Cleaned(roles)); } [Pure] @@ -97,7 +97,7 @@ namespace Squidex.Domain.Apps.Core.Apps return this; } - return Create(new ImmutableDictionary(updated)); + return Create(new ReadonlyDictionary(updated)); } [Pure] @@ -115,7 +115,7 @@ namespace Squidex.Domain.Apps.Core.Apps return this; } - return Create(new ImmutableDictionary(updated)); + return Create(new ReadonlyDictionary(updated)); } [Pure] @@ -135,7 +135,7 @@ namespace Squidex.Domain.Apps.Core.Apps return this; } - return Create(new ImmutableDictionary(updated)); + return Create(new ReadonlyDictionary(updated)); } public static bool IsDefault(string role) @@ -200,7 +200,7 @@ namespace Squidex.Domain.Apps.Core.Apps return inner.Where(x => !Defaults.ContainsKey(x.Key)).ToDictionary(x => x.Key, x => x.Value); } - private Roles Create(ImmutableDictionary newRoles) + private Roles Create(ReadonlyDictionary newRoles) { return ReferenceEquals(inner, newRoles) ? this : new Roles(newRoles); } diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Contents/Json/WorkflowStepSurrogate.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Contents/Json/WorkflowStepSurrogate.cs index 3d26f8628..9ce083b6d 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Contents/Json/WorkflowStepSurrogate.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Contents/Json/WorkflowStepSurrogate.cs @@ -50,7 +50,7 @@ namespace Squidex.Domain.Apps.Core.Contents.Json } var transitions = - Transitions?.ToImmutableDictionary( + Transitions?.ToReadonlyDictionary( x => x.Key, x => x.Value.ToSource()); diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Contents/NoUpdate.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Contents/NoUpdate.cs index a8ea60a83..2a94c1c52 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Contents/NoUpdate.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Contents/NoUpdate.cs @@ -17,7 +17,7 @@ namespace Squidex.Domain.Apps.Core.Contents { if (roles?.Length > 0) { - return new NoUpdate { Expression = expression, Roles = roles?.ToImmutableList() }; + return new NoUpdate { Expression = expression, Roles = roles?.ToReadonlyList() }; } if (!string.IsNullOrWhiteSpace(expression)) diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Contents/Workflow.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Contents/Workflow.cs index d0d6ec00d..0a3b23465 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Contents/Workflow.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Contents/Workflow.cs @@ -21,16 +21,16 @@ namespace Squidex.Domain.Apps.Core.Contents public Status Initial { get; } - public ImmutableDictionary Steps { get; } = ImmutableDictionary.Empty(); + public ReadonlyDictionary Steps { get; } = ReadonlyDictionary.Empty(); - public ImmutableList SchemaIds { get; } = ImmutableList.Empty(); + public ReadonlyList SchemaIds { get; } = ReadonlyList.Empty(); public string Name { get; } public Workflow( Status initial, - ImmutableDictionary? steps = null, - ImmutableList? schemaIds = null, + ReadonlyDictionary? steps = null, + ReadonlyList? schemaIds = null, string? name = null) { Initial = initial; @@ -59,7 +59,7 @@ namespace Squidex.Domain.Apps.Core.Contents new Dictionary { [Status.Draft] = WorkflowTransition.Always - }.ToImmutableDictionary(), + }.ToReadonlyDictionary(), StatusColors.Archived, NoUpdate.Always), [Status.Draft] = new WorkflowStep( @@ -67,7 +67,7 @@ namespace Squidex.Domain.Apps.Core.Contents { [Status.Archived] = WorkflowTransition.Always, [Status.Published] = WorkflowTransition.Always - }.ToImmutableDictionary(), + }.ToReadonlyDictionary(), StatusColors.Draft), [Status.Published] = new WorkflowStep( @@ -75,9 +75,9 @@ namespace Squidex.Domain.Apps.Core.Contents { [Status.Archived] = WorkflowTransition.Always, [Status.Draft] = WorkflowTransition.Always - }.ToImmutableDictionary(), + }.ToReadonlyDictionary(), StatusColors.Published) - }.ToImmutableDictionary(), null, name); + }.ToReadonlyDictionary(), null, name); } public IEnumerable<(Status Status, WorkflowStep Step, WorkflowTransition Transition)> GetTransitions(Status status) diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Contents/WorkflowCondition.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Contents/WorkflowCondition.cs index ff66a042e..e6117991a 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Contents/WorkflowCondition.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Contents/WorkflowCondition.cs @@ -13,6 +13,6 @@ namespace Squidex.Domain.Apps.Core.Contents { public string? Expression { get; init; } - public ImmutableList? Roles { get; init; } + public ReadonlyList? Roles { get; init; } } } diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Contents/WorkflowStep.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Contents/WorkflowStep.cs index 4bbecf56b..7d0855fa0 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Contents/WorkflowStep.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Contents/WorkflowStep.cs @@ -11,13 +11,13 @@ namespace Squidex.Domain.Apps.Core.Contents { public sealed record WorkflowStep { - public ImmutableDictionary Transitions { get; } = ImmutableDictionary.Empty(); + public ReadonlyDictionary Transitions { get; } = ReadonlyDictionary.Empty(); public string? Color { get; } public NoUpdate? NoUpdate { get; } - public WorkflowStep(ImmutableDictionary? transitions = null, string? color = null, NoUpdate? noUpdate = null) + public WorkflowStep(ReadonlyDictionary? transitions = null, string? color = null, NoUpdate? noUpdate = null) { Color = color; diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Contents/WorkflowTransition.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Contents/WorkflowTransition.cs index 971423aa8..e163d49c5 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Contents/WorkflowTransition.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Contents/WorkflowTransition.cs @@ -17,7 +17,7 @@ namespace Squidex.Domain.Apps.Core.Contents { if (roles?.Length > 0) { - return new WorkflowTransition { Expression = expression, Roles = roles?.ToImmutableList() }; + return new WorkflowTransition { Expression = expression, Roles = roles?.ToReadonlyList() }; } if (!string.IsNullOrWhiteSpace(expression)) diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Contents/Workflows.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Contents/Workflows.cs index a256c0212..37be3fcc2 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Contents/Workflows.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Contents/Workflows.cs @@ -13,7 +13,7 @@ using Squidex.Infrastructure.Collections; namespace Squidex.Domain.Apps.Core.Contents { - public sealed class Workflows : ImmutableDictionary + public sealed class Workflows : ReadonlyDictionary { public static readonly Workflows Empty = new Workflows(); diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Rules/Triggers/ContentChangedTriggerV2.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Rules/Triggers/ContentChangedTriggerV2.cs index 1f1c9d0ed..e3f522ce6 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Rules/Triggers/ContentChangedTriggerV2.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Rules/Triggers/ContentChangedTriggerV2.cs @@ -13,7 +13,7 @@ namespace Squidex.Domain.Apps.Core.Rules.Triggers [TypeName(nameof(ContentChangedTriggerV2))] public sealed record ContentChangedTriggerV2 : RuleTrigger { - public ImmutableList? Schemas { get; init; } + public ReadonlyList? Schemas { get; init; } public bool HandleAll { get; init; } diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ArrayFieldProperties.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ArrayFieldProperties.cs index 8364b5f7a..13c2f79f8 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ArrayFieldProperties.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ArrayFieldProperties.cs @@ -16,7 +16,7 @@ namespace Squidex.Domain.Apps.Core.Schemas public int? MaxItems { get; init; } - public ImmutableList? UniqueFields { get; init; } + public ReadonlyList? UniqueFields { get; init; } public override T Accept(IFieldPropertiesVisitor visitor, TArgs args) { diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/AssetsFieldProperties.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/AssetsFieldProperties.cs index 24b1e06a0..efd119058 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/AssetsFieldProperties.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/AssetsFieldProperties.cs @@ -15,9 +15,9 @@ namespace Squidex.Domain.Apps.Core.Schemas { public AssetPreviewMode PreviewMode { get; init; } - public LocalizedValue?> DefaultValues { get; init; } + public LocalizedValue?> DefaultValues { get; init; } - public ImmutableList? DefaultValue { get; init; } + public ReadonlyList? DefaultValue { get; init; } public string? FolderId { get; init; } @@ -59,7 +59,7 @@ namespace Squidex.Domain.Apps.Core.Schemas init => ResolveFirst = value; } - public ImmutableList? AllowedExtensions { get; set; } + public ReadonlyList? AllowedExtensions { get; set; } public override T Accept(IFieldPropertiesVisitor visitor, TArgs args) { diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ComponentFieldProperties.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ComponentFieldProperties.cs index eab4efcb8..cc5e58365 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ComponentFieldProperties.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ComponentFieldProperties.cs @@ -19,7 +19,7 @@ namespace Squidex.Domain.Apps.Core.Schemas { if (value != default) { - SchemaIds = ImmutableList.Create(value); + SchemaIds = ReadonlyList.Create(value); } else { @@ -32,7 +32,7 @@ namespace Squidex.Domain.Apps.Core.Schemas } } - public ImmutableList? SchemaIds { get; init; } + public ReadonlyList? SchemaIds { get; init; } public override T Accept(IFieldPropertiesVisitor visitor, TArgs args) { diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ComponentsFieldProperties.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ComponentsFieldProperties.cs index 8e4696c12..2eced736d 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ComponentsFieldProperties.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ComponentsFieldProperties.cs @@ -17,7 +17,7 @@ namespace Squidex.Domain.Apps.Core.Schemas public int? MaxItems { get; init; } - public ImmutableList? UniqueFields { get; init; } + public ReadonlyList? UniqueFields { get; init; } public DomainId SchemaId { @@ -25,7 +25,7 @@ namespace Squidex.Domain.Apps.Core.Schemas { if (value != default) { - SchemaIds = ImmutableList.Create(value); + SchemaIds = ReadonlyList.Create(value); } else { @@ -38,7 +38,7 @@ namespace Squidex.Domain.Apps.Core.Schemas } } - public ImmutableList? SchemaIds { get; init; } + public ReadonlyList? SchemaIds { get; init; } public override T Accept(IFieldPropertiesVisitor visitor, TArgs args) { diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldExtensions.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldExtensions.cs index f575e3a51..8db08dc35 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldExtensions.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldExtensions.cs @@ -25,7 +25,7 @@ namespace Squidex.Domain.Apps.Core.Schemas return fields.Where(x => IsForApi(x, withHidden)); } - public static IEnumerable GetSharedFields(this ResolvedComponents components, ImmutableList? schemaIds, bool withHidden) + public static IEnumerable GetSharedFields(this ResolvedComponents components, ReadonlyList? schemaIds, bool withHidden) { if (schemaIds == null || schemaIds.Count == 0) { diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldNames.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldNames.cs index 3bcc3d1bf..480b3cca7 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldNames.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldNames.cs @@ -11,7 +11,7 @@ using Squidex.Infrastructure.Collections; namespace Squidex.Domain.Apps.Core.Schemas { - public sealed class FieldNames : ImmutableList + public sealed class FieldNames : ReadonlyList { public static readonly FieldNames Empty = new FieldNames(new List()); diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldProperties.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldProperties.cs index 74484e766..19d274449 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldProperties.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldProperties.cs @@ -21,7 +21,7 @@ namespace Squidex.Domain.Apps.Core.Schemas public string? EditorUrl { get; init; } - public ImmutableList? Tags { get; init; } + public ReadonlyList? Tags { get; init; } public abstract T Accept(IFieldPropertiesVisitor visitor, TArgs args); diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldRules.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldRules.cs index 539b9e757..ab3cfcd66 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldRules.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldRules.cs @@ -11,7 +11,7 @@ using Squidex.Infrastructure.Collections; namespace Squidex.Domain.Apps.Core.Schemas { - public sealed class FieldRules : ImmutableList + public sealed class FieldRules : ReadonlyList { public static readonly FieldRules Empty = new FieldRules(new List()); diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/Json/SchemaSurrogate.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/Json/SchemaSurrogate.cs index 589b35dd2..cf5971bb6 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/Json/SchemaSurrogate.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/Json/SchemaSurrogate.cs @@ -35,7 +35,7 @@ namespace Squidex.Domain.Apps.Core.Schemas.Json public FieldSurrogate[] Fields { get; set; } - public ImmutableDictionary? PreviewUrls { get; set; } + public ReadonlyDictionary? PreviewUrls { get; set; } public bool IsSingleton { diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/LocalizedValue.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/LocalizedValue.cs index f6f5cbbcd..00624c014 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/LocalizedValue.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/LocalizedValue.cs @@ -10,7 +10,7 @@ using Squidex.Infrastructure.Collections; namespace Squidex.Domain.Apps.Core.Schemas { - public sealed class LocalizedValue : ImmutableDictionary + public sealed class LocalizedValue : ReadonlyDictionary { public LocalizedValue() { diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/NumberFieldProperties.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/NumberFieldProperties.cs index 6d4d7b3ef..4c793155e 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/NumberFieldProperties.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/NumberFieldProperties.cs @@ -11,7 +11,7 @@ namespace Squidex.Domain.Apps.Core.Schemas { public sealed record NumberFieldProperties : FieldProperties { - public ImmutableList? AllowedValues { get; init; } + public ReadonlyList? AllowedValues { get; init; } public LocalizedValue DefaultValues { get; init; } diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ReferencesFieldProperties.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ReferencesFieldProperties.cs index 50c029f89..558ea1f8c 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ReferencesFieldProperties.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ReferencesFieldProperties.cs @@ -13,9 +13,9 @@ namespace Squidex.Domain.Apps.Core.Schemas { public sealed record ReferencesFieldProperties : FieldProperties { - public LocalizedValue?> DefaultValues { get; init; } + public LocalizedValue?> DefaultValues { get; init; } - public ImmutableList? DefaultValue { get; init; } + public ReadonlyList? DefaultValue { get; init; } public int? MinItems { get; init; } @@ -35,7 +35,7 @@ namespace Squidex.Domain.Apps.Core.Schemas { if (value != default) { - SchemaIds = ImmutableList.Create(value); + SchemaIds = ReadonlyList.Create(value); } else { @@ -48,7 +48,7 @@ namespace Squidex.Domain.Apps.Core.Schemas } } - public ImmutableList? SchemaIds { get; init; } + public ReadonlyList? SchemaIds { get; init; } public override T Accept(IFieldPropertiesVisitor visitor, TArgs args) { diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ResolvedComponents.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ResolvedComponents.cs index c1706bc1e..6008cf362 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ResolvedComponents.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ResolvedComponents.cs @@ -11,7 +11,7 @@ using Squidex.Infrastructure.Collections; namespace Squidex.Domain.Apps.Core.Schemas { - public sealed class ResolvedComponents : ImmutableDictionary + public sealed class ResolvedComponents : ReadonlyDictionary { public static readonly ResolvedComponents Empty = new ResolvedComponents(); diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/Schema.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/Schema.cs index 11d7bf00f..4aa1676af 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/Schema.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/Schema.cs @@ -36,7 +36,7 @@ namespace Squidex.Domain.Apps.Core.Schemas public SchemaProperties Properties { get; private set; } = new SchemaProperties(); - public ImmutableDictionary PreviewUrls { get; private set; } = ImmutableDictionary.Empty(); + public ReadonlyDictionary PreviewUrls { get; private set; } = ReadonlyDictionary.Empty(); public IReadOnlyList Fields { @@ -218,9 +218,9 @@ namespace Squidex.Domain.Apps.Core.Schemas } [Pure] - public Schema SetPreviewUrls(ImmutableDictionary? previewUrls) + public Schema SetPreviewUrls(ReadonlyDictionary? previewUrls) { - previewUrls ??= ImmutableDictionary.Empty(); + previewUrls ??= ReadonlyDictionary.Empty(); if (PreviewUrls.Equals(previewUrls)) { diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/SchemaProperties.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/SchemaProperties.cs index bb5955577..a86cc8a0a 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/SchemaProperties.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/SchemaProperties.cs @@ -13,7 +13,7 @@ namespace Squidex.Domain.Apps.Core.Schemas { public static readonly SchemaProperties Empty = new SchemaProperties(); - public ImmutableList? Tags { get; init; } + public ReadonlyList? Tags { get; init; } public string? ContentsSidebarUrl { get; init; } diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/StringFieldProperties.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/StringFieldProperties.cs index c4bb2d1bc..8930e40a4 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/StringFieldProperties.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/StringFieldProperties.cs @@ -11,7 +11,7 @@ namespace Squidex.Domain.Apps.Core.Schemas { public sealed record StringFieldProperties : FieldProperties { - public ImmutableList? AllowedValues { get; init; } + public ReadonlyList? AllowedValues { get; init; } public LocalizedValue DefaultValues { get; init; } diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/TagsFieldProperties.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/TagsFieldProperties.cs index a1424aef6..98c8733da 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/TagsFieldProperties.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/TagsFieldProperties.cs @@ -11,11 +11,11 @@ namespace Squidex.Domain.Apps.Core.Schemas { public sealed record TagsFieldProperties : FieldProperties { - public ImmutableList? AllowedValues { get; init; } + public ReadonlyList? AllowedValues { get; init; } - public LocalizedValue?> DefaultValues { get; init; } + public LocalizedValue?> DefaultValues { get; init; } - public ImmutableList? DefaultValue { get; init; } + public ReadonlyList? DefaultValue { get; init; } public int? MinItems { get; init; } diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/JsonTypeVisitor.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/JsonTypeVisitor.cs index 6a4fd9949..ec249e09b 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/JsonTypeVisitor.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/JsonTypeVisitor.cs @@ -177,7 +177,7 @@ namespace Squidex.Domain.Apps.Core.GenerateJsonSchema return null; } - private void BuildComponent(JsonSchema jsonSchema, ImmutableList? schemaIds, Args args) + private void BuildComponent(JsonSchema jsonSchema, ReadonlyList? schemaIds, Args args) { jsonSchema.Properties.Add(Component.Discriminator, SchemaBuilder.StringProperty(isRequired: true)); diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/JsonValueConverter.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/JsonValueConverter.cs index c80951217..bc056dc30 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/JsonValueConverter.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/JsonValueConverter.cs @@ -218,7 +218,7 @@ namespace Squidex.Domain.Apps.Core.ValidateContent } private static (object? Result, JsonError? Error) ConvertToComponentList(IJsonValue value, - ResolvedComponents components, ImmutableList? allowedIds) + ResolvedComponents components, ReadonlyList? allowedIds) { if (value is JsonArray array) { @@ -246,7 +246,7 @@ namespace Squidex.Domain.Apps.Core.ValidateContent } private static (Component? Result, JsonError? Error) ConvertToComponent(IJsonValue value, - ResolvedComponents components, ImmutableList? allowedIds) + ResolvedComponents components, ReadonlyList? allowedIds) { if (value is not JsonObject obj) { diff --git a/backend/src/Squidex.Domain.Apps.Entities/AppProviderExtensions.cs b/backend/src/Squidex.Domain.Apps.Entities/AppProviderExtensions.cs index a5d8943be..39b3e198c 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/AppProviderExtensions.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/AppProviderExtensions.cs @@ -24,7 +24,7 @@ namespace Squidex.Domain.Apps.Entities var appId = schema.AppId.Id; - async Task ResolveWithIdsAsync(IField field, ImmutableList? schemaIds) + async Task ResolveWithIdsAsync(IField field, ReadonlyList? schemaIds) { if (schemaIds != null) { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/Templates/CreateProfile.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/Templates/CreateProfile.cs index 9c0802526..83ab7f9e1 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/Templates/CreateProfile.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/Templates/CreateProfile.cs @@ -250,7 +250,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Templates .AddString("Experience", f => f .Properties(p => p with { - AllowedValues = ImmutableList.Create( + AllowedValues = ReadonlyList.Create( "Beginner", "Advanced", "Professional", diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ComponentUnionGraphType.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ComponentUnionGraphType.cs index 0e12aebf8..591bc5598 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ComponentUnionGraphType.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ComponentUnionGraphType.cs @@ -21,7 +21,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Contents public bool HasType => types.Count > 0; - public ComponentUnionGraphType(Builder builder, FieldInfo fieldInfo, ImmutableList? schemaIds) + public ComponentUnionGraphType(Builder builder, FieldInfo fieldInfo, ReadonlyList? schemaIds) { // The name is used for equal comparison. Therefore it is important to treat it as readonly. Name = fieldInfo.ReferenceType; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/FieldVisitor.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/FieldVisitor.cs index 464b88ca1..ca54815c2 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/FieldVisitor.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/FieldVisitor.cs @@ -195,7 +195,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Contents return default; } - private IGraphType? ResolveReferences(FieldInfo fieldInfo, ImmutableList? schemaIds) + private IGraphType? ResolveReferences(FieldInfo fieldInfo, ReadonlyList? schemaIds) { IGraphType? contentType = null; @@ -219,7 +219,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Contents return contentType; } - private IGraphType? ResolveComponent(FieldInfo fieldInfo, ImmutableList? schemaIds) + private IGraphType? ResolveComponent(FieldInfo fieldInfo, ReadonlyList? schemaIds) { IGraphType? componentType = null; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ReferenceUnionGraphType.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ReferenceUnionGraphType.cs index 28fc3335c..3e1dd6874 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ReferenceUnionGraphType.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ReferenceUnionGraphType.cs @@ -19,7 +19,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Contents public bool HasType => types.Count > 0; - public ReferenceUnionGraphType(Builder builder, FieldInfo fieldInfo, ImmutableList? schemaIds) + public ReferenceUnionGraphType(Builder builder, FieldInfo fieldInfo, ReadonlyList? schemaIds) { // The name is used for equal comparison. Therefore it is important to treat it as readonly. Name = fieldInfo.ReferenceType; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Schemas/Commands/ConfigurePreviewUrls.cs b/backend/src/Squidex.Domain.Apps.Entities/Schemas/Commands/ConfigurePreviewUrls.cs index d295d4d44..710140670 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Schemas/Commands/ConfigurePreviewUrls.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Schemas/Commands/ConfigurePreviewUrls.cs @@ -11,6 +11,6 @@ namespace Squidex.Domain.Apps.Entities.Schemas.Commands { public sealed class ConfigurePreviewUrls : SchemaUpdateCommand { - public ImmutableDictionary? PreviewUrls { get; set; } + public ReadonlyDictionary? PreviewUrls { get; set; } } } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Schemas/Commands/CreateSchema.cs b/backend/src/Squidex.Domain.Apps.Entities/Schemas/Commands/CreateSchema.cs index c417ef396..f534af351 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Schemas/Commands/CreateSchema.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Schemas/Commands/CreateSchema.cs @@ -38,7 +38,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas.Commands public SchemaProperties Properties { get; set; } - public ImmutableDictionary? PreviewUrls { get; set; } + public ReadonlyDictionary? PreviewUrls { get; set; } [IgnoreDataMember] public override DomainId AggregateId diff --git a/backend/src/Squidex.Domain.Apps.Entities/Schemas/Commands/IUpsertCommand.cs b/backend/src/Squidex.Domain.Apps.Entities/Schemas/Commands/IUpsertCommand.cs index d515dd5ff..fa5a6a430 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Schemas/Commands/IUpsertCommand.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Schemas/Commands/IUpsertCommand.cs @@ -31,7 +31,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas.Commands FieldRuleCommand[]? FieldRules { get; set; } - ImmutableDictionary? PreviewUrls { get; set; } + ReadonlyDictionary? PreviewUrls { get; set; } Schema ToSchema(string name, SchemaType type) { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Schemas/Commands/SynchronizeSchema.cs b/backend/src/Squidex.Domain.Apps.Entities/Schemas/Commands/SynchronizeSchema.cs index c3808e4e3..260bb335b 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Schemas/Commands/SynchronizeSchema.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Schemas/Commands/SynchronizeSchema.cs @@ -34,7 +34,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas.Commands public SchemaProperties Properties { get; set; } - public ImmutableDictionary? PreviewUrls { get; set; } + public ReadonlyDictionary? PreviewUrls { get; set; } public Schema BuildSchema(string name, SchemaType type) { diff --git a/backend/src/Squidex.Domain.Apps.Events/Schemas/SchemaPreviewUrlsConfigured.cs b/backend/src/Squidex.Domain.Apps.Events/Schemas/SchemaPreviewUrlsConfigured.cs index 01c121d0d..849e27d98 100644 --- a/backend/src/Squidex.Domain.Apps.Events/Schemas/SchemaPreviewUrlsConfigured.cs +++ b/backend/src/Squidex.Domain.Apps.Events/Schemas/SchemaPreviewUrlsConfigured.cs @@ -13,6 +13,6 @@ namespace Squidex.Domain.Apps.Events.Schemas [EventType(nameof(SchemaPreviewUrlsConfigured))] public sealed class SchemaPreviewUrlsConfigured : SchemaEvent { - public ImmutableDictionary? PreviewUrls { get; set; } + public ReadonlyDictionary? PreviewUrls { get; set; } } } diff --git a/backend/src/Squidex.Infrastructure/Collections/ImmutableDictionary.cs b/backend/src/Squidex.Infrastructure/Collections/ReadonlyDictionary.cs similarity index 56% rename from backend/src/Squidex.Infrastructure/Collections/ImmutableDictionary.cs rename to backend/src/Squidex.Infrastructure/Collections/ReadonlyDictionary.cs index d8c1a819a..c76359a3b 100644 --- a/backend/src/Squidex.Infrastructure/Collections/ImmutableDictionary.cs +++ b/backend/src/Squidex.Infrastructure/Collections/ReadonlyDictionary.cs @@ -11,31 +11,31 @@ using System.Linq; namespace Squidex.Infrastructure.Collections { - public static class ImmutableDictionary + public static class ReadonlyDictionary { private static class Empties where TKey : notnull { #pragma warning disable SA1401 // Fields should be private - public static ImmutableDictionary Instance = new ImmutableDictionary(); + public static ReadonlyDictionary Instance = new ReadonlyDictionary(); #pragma warning restore SA1401 // Fields should be private } - public static ImmutableDictionary Empty() where TKey : notnull + public static ReadonlyDictionary Empty() where TKey : notnull { return Empties.Instance; } - public static ImmutableDictionary ToImmutableDictionary(this Dictionary source) where TKey : notnull + public static ReadonlyDictionary ToReadonlyDictionary(this Dictionary source) where TKey : notnull { if (source.Count == 0) { return Empty(); } - return new ImmutableDictionary(source); + return new ReadonlyDictionary(source); } - public static ImmutableDictionary ToImmutableDictionary(this IEnumerable source, Func keySelector) where TKey : notnull + public static ReadonlyDictionary ToReadonlyDictionary(this IEnumerable source, Func keySelector) where TKey : notnull { var inner = source.ToDictionary(keySelector); @@ -44,10 +44,10 @@ namespace Squidex.Infrastructure.Collections return Empty(); } - return new ImmutableDictionary(inner); + return new ReadonlyDictionary(inner); } - public static ImmutableDictionary ToImmutableDictionary(this IEnumerable source, Func keySelector, Func elementSelector) where TKey : notnull + public static ReadonlyDictionary ToReadonlyDictionary(this IEnumerable source, Func keySelector, Func elementSelector) where TKey : notnull { var inner = source.ToDictionary(keySelector, elementSelector); @@ -56,7 +56,7 @@ namespace Squidex.Infrastructure.Collections return Empty(); } - return new ImmutableDictionary(inner); + return new ReadonlyDictionary(inner); } } } diff --git a/backend/src/Squidex.Infrastructure/Collections/ImmutableDictionary{TKey,TValue}.cs b/backend/src/Squidex.Infrastructure/Collections/ReadonlyDictionary{TKey,TValue}.cs similarity index 85% rename from backend/src/Squidex.Infrastructure/Collections/ImmutableDictionary{TKey,TValue}.cs rename to backend/src/Squidex.Infrastructure/Collections/ReadonlyDictionary{TKey,TValue}.cs index 11ee89794..511194bb4 100644 --- a/backend/src/Squidex.Infrastructure/Collections/ImmutableDictionary{TKey,TValue}.cs +++ b/backend/src/Squidex.Infrastructure/Collections/ReadonlyDictionary{TKey,TValue}.cs @@ -12,7 +12,7 @@ using System.Diagnostics.CodeAnalysis; namespace Squidex.Infrastructure.Collections { - public class ImmutableDictionary : IReadOnlyDictionary, IEquatable> where TKey : notnull + public class ReadonlyDictionary : IReadOnlyDictionary, IEquatable> where TKey : notnull { private static readonly Dictionary EmptyInner = new Dictionary(); private readonly IDictionary inner; @@ -45,12 +45,12 @@ namespace Squidex.Infrastructure.Collections get => inner.Count; } - public ImmutableDictionary() + public ReadonlyDictionary() : this(EmptyInner) { } - public ImmutableDictionary(IDictionary inner) + public ReadonlyDictionary(IDictionary inner) { Guard.NotNull(inner, nameof(inner)); @@ -84,10 +84,10 @@ namespace Squidex.Infrastructure.Collections public override bool Equals(object? obj) { - return Equals(obj as ImmutableDictionary); + return Equals(obj as ReadonlyDictionary); } - public bool Equals(ImmutableDictionary? other) + public bool Equals(ReadonlyDictionary? other) { return this.EqualsDictionary(other); } diff --git a/backend/src/Squidex.Infrastructure/Collections/ImmutableList.cs b/backend/src/Squidex.Infrastructure/Collections/ReadonlyList.cs similarity index 70% rename from backend/src/Squidex.Infrastructure/Collections/ImmutableList.cs rename to backend/src/Squidex.Infrastructure/Collections/ReadonlyList.cs index 5f73170c4..14ee2bf06 100644 --- a/backend/src/Squidex.Infrastructure/Collections/ImmutableList.cs +++ b/backend/src/Squidex.Infrastructure/Collections/ReadonlyList.cs @@ -10,31 +10,31 @@ using System.Linq; namespace Squidex.Infrastructure.Collections { - public static class ImmutableList + public static class ReadonlyList { private static class Empties { #pragma warning disable SA1401 // Fields should be private - public static ImmutableList Instance = new ImmutableList(); + public static ReadonlyList Instance = new ReadonlyList(); #pragma warning restore SA1401 // Fields should be private } - public static ImmutableList Empty() + public static ReadonlyList Empty() { return Empties.Instance; } - public static ImmutableList Create(params T[]? items) + public static ReadonlyList Create(params T[]? items) { if (items == null || items.Length == 0) { return Empty(); } - return new ImmutableList(items.ToList()); + return new ReadonlyList(items.ToList()); } - public static ImmutableList ToImmutableList(this IEnumerable source) + public static ReadonlyList ToReadonlyList(this IEnumerable source) { var inner = source.ToList(); @@ -43,7 +43,7 @@ namespace Squidex.Infrastructure.Collections return Empty(); } - return new ImmutableList(inner); + return new ReadonlyList(inner); } } } diff --git a/backend/src/Squidex.Infrastructure/Collections/ImmutableList{T}.cs b/backend/src/Squidex.Infrastructure/Collections/ReadonlyList{T}.cs similarity index 77% rename from backend/src/Squidex.Infrastructure/Collections/ImmutableList{T}.cs rename to backend/src/Squidex.Infrastructure/Collections/ReadonlyList{T}.cs index 56154f34d..1407e1db9 100644 --- a/backend/src/Squidex.Infrastructure/Collections/ImmutableList{T}.cs +++ b/backend/src/Squidex.Infrastructure/Collections/ReadonlyList{T}.cs @@ -11,26 +11,26 @@ using System.Collections.ObjectModel; namespace Squidex.Infrastructure.Collections { - public class ImmutableList : ReadOnlyCollection, IEquatable> + public class ReadonlyList : ReadOnlyCollection, IEquatable> { private static readonly List EmptyInner = new List(); - public ImmutableList() + public ReadonlyList() : base(EmptyInner) { } - public ImmutableList(IList list) + public ReadonlyList(IList list) : base(list) { } public override bool Equals(object? obj) { - return Equals(obj as ImmutableList); + return Equals(obj as ReadonlyList); } - public virtual bool Equals(ImmutableList? other) + public virtual bool Equals(ReadonlyList? other) { return this.EqualsList(other); } diff --git a/backend/src/Squidex.Infrastructure/Queries/PropertyPath.cs b/backend/src/Squidex.Infrastructure/Queries/PropertyPath.cs index 1d52eeb8d..acbb60a3f 100644 --- a/backend/src/Squidex.Infrastructure/Queries/PropertyPath.cs +++ b/backend/src/Squidex.Infrastructure/Queries/PropertyPath.cs @@ -12,7 +12,7 @@ using Squidex.Infrastructure.Collections; namespace Squidex.Infrastructure.Queries { - public sealed class PropertyPath : ImmutableList + public sealed class PropertyPath : ReadonlyList { private static readonly char[] Separators = { '.', '/' }; diff --git a/backend/src/Squidex.Infrastructure/Security/PermissionSet.cs b/backend/src/Squidex.Infrastructure/Security/PermissionSet.cs index 6e3c616fe..30222fe5f 100644 --- a/backend/src/Squidex.Infrastructure/Security/PermissionSet.cs +++ b/backend/src/Squidex.Infrastructure/Security/PermissionSet.cs @@ -12,7 +12,7 @@ using Squidex.Infrastructure.Collections; namespace Squidex.Infrastructure.Security { - public sealed class PermissionSet : ImmutableList + public sealed class PermissionSet : ReadonlyList { public static readonly PermissionSet Empty = new PermissionSet(Array.Empty()); diff --git a/backend/src/Squidex/Areas/Api/Config/OpenApi/ReflectionServices.cs b/backend/src/Squidex/Areas/Api/Config/OpenApi/ReflectionServices.cs index f5416574f..96ef39020 100644 --- a/backend/src/Squidex/Areas/Api/Config/OpenApi/ReflectionServices.cs +++ b/backend/src/Squidex/Areas/Api/Config/OpenApi/ReflectionServices.cs @@ -16,7 +16,7 @@ namespace Squidex.Areas.Api.Config.OpenApi protected override bool IsArrayType(ContextualType contextualType) { if (contextualType.Type.IsGenericType && - contextualType.Type.GetGenericTypeDefinition() == typeof(ImmutableList<>)) + contextualType.Type.GetGenericTypeDefinition() == typeof(ReadonlyList<>)) { return true; } @@ -27,7 +27,7 @@ namespace Squidex.Areas.Api.Config.OpenApi protected override bool IsDictionaryType(ContextualType contextualType) { if (contextualType.Type.IsGenericType && - contextualType.Type.GetGenericTypeDefinition() == typeof(ImmutableDictionary<,>)) + contextualType.Type.GetGenericTypeDefinition() == typeof(ReadonlyDictionary<,>)) { return true; } diff --git a/backend/src/Squidex/Areas/Api/Controllers/Apps/Models/UpdateAppSettingsDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Apps/Models/UpdateAppSettingsDto.cs index 7d0ed5dcf..6185ee862 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Apps/Models/UpdateAppSettingsDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Apps/Models/UpdateAppSettingsDto.cs @@ -43,10 +43,10 @@ namespace Squidex.Areas.Api.Controllers.Apps.Models { Settings = new AppSettings { - Editors = Editors?.Select(x => x.ToEditor()).ToImmutableList()!, + Editors = Editors?.Select(x => x.ToEditor()).ToReadonlyList()!, HideScheduler = HideScheduler, HideDateTimeModeButton = HideDateTimeModeButton, - Patterns = Patterns?.Select(x => x.ToPattern()).ToImmutableList()! + Patterns = Patterns?.Select(x => x.ToPattern()).ToReadonlyList()! } }; } diff --git a/backend/src/Squidex/Areas/Api/Controllers/Apps/Models/UpdateWorkflowDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Apps/Models/UpdateWorkflowDto.cs index 6adb82ae7..7a0449c94 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Apps/Models/UpdateWorkflowDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Apps/Models/UpdateWorkflowDto.cs @@ -30,7 +30,7 @@ namespace Squidex.Areas.Api.Controllers.Apps.Models /// /// The schema ids. /// - public ImmutableList? SchemaIds { get; set; } + public ReadonlyList? SchemaIds { get; set; } /// /// The initial step. @@ -42,7 +42,7 @@ namespace Squidex.Areas.Api.Controllers.Apps.Models { var workflow = new Workflow( Initial, - Steps?.ToImmutableDictionary( + Steps?.ToReadonlyDictionary( x => x.Key, x => x.Value?.ToWorkflowStep()!), SchemaIds, diff --git a/backend/src/Squidex/Areas/Api/Controllers/Apps/Models/WorkflowDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Apps/Models/WorkflowDto.cs index b61b5cda1..3d584c9d2 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Apps/Models/WorkflowDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Apps/Models/WorkflowDto.cs @@ -37,7 +37,7 @@ namespace Squidex.Areas.Api.Controllers.Apps.Models /// /// The schema ids. /// - public ImmutableList? SchemaIds { get; set; } + public ReadonlyList? SchemaIds { get; set; } /// /// The initial step. diff --git a/backend/src/Squidex/Areas/Api/Controllers/Apps/Models/WorkflowStepDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Apps/Models/WorkflowStepDto.cs index 61156e3fb..2854ee856 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Apps/Models/WorkflowStepDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Apps/Models/WorkflowStepDto.cs @@ -65,7 +65,7 @@ namespace Squidex.Areas.Api.Controllers.Apps.Models public WorkflowStep ToWorkflowStep() { return new WorkflowStep( - Transitions?.ToImmutableDictionary( + Transitions?.ToReadonlyDictionary( y => y.Key, y => y.Value?.ToWorkflowTransition()!), Color, diff --git a/backend/src/Squidex/Areas/Api/Controllers/Assets/AssetFoldersController.cs b/backend/src/Squidex/Areas/Api/Controllers/Assets/AssetFoldersController.cs index 22839c2ac..050f044ba 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Assets/AssetFoldersController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Assets/AssetFoldersController.cs @@ -178,7 +178,7 @@ namespace Squidex.Areas.Api.Controllers.Assets { if (scope == AssetFolderScope.Items) { - return Task.FromResult>(ImmutableList.Empty()); + return Task.FromResult>(ReadonlyList.Empty()); } return assetQuery.FindAssetFolderAsync(Context.App.Id, parentId, HttpContext.RequestAborted); diff --git a/backend/src/Squidex/Areas/Api/Controllers/Rules/Models/Triggers/ContentChangedRuleTriggerDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Rules/Models/Triggers/ContentChangedRuleTriggerDto.cs index 2d65c52ed..731cb0c4b 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Rules/Models/Triggers/ContentChangedRuleTriggerDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Rules/Models/Triggers/ContentChangedRuleTriggerDto.cs @@ -26,7 +26,7 @@ namespace Squidex.Areas.Api.Controllers.Rules.Models.Triggers public override RuleTrigger ToTrigger() { - var schemas = Schemas?.Select(x => x.ToTrigger()).ToImmutableList(); + var schemas = Schemas?.Select(x => x.ToTrigger()).ToReadonlyList(); return new ContentChangedTriggerV2 { HandleAll = HandleAll, Schemas = schemas }; } diff --git a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/ConfigurePreviewUrlsDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/ConfigurePreviewUrlsDto.cs index 1d69f5107..2364fd51b 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/ConfigurePreviewUrlsDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/ConfigurePreviewUrlsDto.cs @@ -17,7 +17,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models { return new ConfigurePreviewUrls { - PreviewUrls = new Dictionary(this).ToImmutableDictionary() + PreviewUrls = new Dictionary(this).ToReadonlyDictionary() }; } } diff --git a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/FieldPropertiesDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/FieldPropertiesDto.cs index 5bb8cecc1..54d5691f3 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/FieldPropertiesDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/FieldPropertiesDto.cs @@ -61,7 +61,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models /// /// Tags for automation processes. /// - public ImmutableList? Tags { get; set; } + public ReadonlyList? Tags { get; set; } public abstract FieldProperties ToProperties(); diff --git a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/ArrayFieldPropertiesDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/ArrayFieldPropertiesDto.cs index 3691c93b7..68f412b52 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/ArrayFieldPropertiesDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/ArrayFieldPropertiesDto.cs @@ -26,7 +26,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models.Fields /// /// The fields that must be unique. /// - public ImmutableList? UniqueFields { get; set; } + public ReadonlyList? UniqueFields { get; set; } public override FieldProperties ToProperties() { diff --git a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/AssetsFieldPropertiesDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/AssetsFieldPropertiesDto.cs index 877b16658..53af5e9c0 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/AssetsFieldPropertiesDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/AssetsFieldPropertiesDto.cs @@ -23,12 +23,12 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models.Fields /// /// The language specific default value as a list of asset ids. /// - public LocalizedValue?> DefaultValues { get; set; } + public LocalizedValue?> DefaultValues { get; set; } /// /// The default value as a list of asset ids. /// - public ImmutableList? DefaultValue { get; set; } + public ReadonlyList? DefaultValue { get; set; } /// /// The initial id to the folder. @@ -118,7 +118,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models.Fields /// /// The allowed file extensions. /// - public ImmutableList? AllowedExtensions { get; set; } + public ReadonlyList? AllowedExtensions { get; set; } /// /// True, if duplicate values are allowed. diff --git a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/ComponentFieldPropertiesDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/ComponentFieldPropertiesDto.cs index d70301f49..956832e98 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/ComponentFieldPropertiesDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/ComponentFieldPropertiesDto.cs @@ -17,7 +17,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models.Fields /// /// The id of the embedded schemas. /// - public ImmutableList? SchemaIds { get; set; } + public ReadonlyList? SchemaIds { get; set; } public override FieldProperties ToProperties() { diff --git a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/ComponentsFieldPropertiesDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/ComponentsFieldPropertiesDto.cs index 912d899fc..dfcbcc410 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/ComponentsFieldPropertiesDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/ComponentsFieldPropertiesDto.cs @@ -27,12 +27,12 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models.Fields /// /// The id of the embedded schemas. /// - public ImmutableList? SchemaIds { get; set; } + public ReadonlyList? SchemaIds { get; set; } /// /// The fields that must be unique. /// - public ImmutableList? UniqueFields { get; set; } + public ReadonlyList? UniqueFields { get; set; } public override FieldProperties ToProperties() { diff --git a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/NumberFieldPropertiesDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/NumberFieldPropertiesDto.cs index e302aab76..908645f50 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/NumberFieldPropertiesDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/NumberFieldPropertiesDto.cs @@ -36,7 +36,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models.Fields /// /// The allowed values for the field value. /// - public ImmutableList? AllowedValues { get; set; } + public ReadonlyList? AllowedValues { get; set; } /// /// Indicates if the field value must be unique. Ignored for nested fields and localized fields. diff --git a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/ReferencesFieldPropertiesDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/ReferencesFieldPropertiesDto.cs index 11b7db44a..a320918a6 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/ReferencesFieldPropertiesDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/ReferencesFieldPropertiesDto.cs @@ -17,12 +17,12 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models.Fields /// /// The language specific default value as a list of content ids. /// - public LocalizedValue?> DefaultValues { get; set; } + public LocalizedValue?> DefaultValues { get; set; } /// /// The default value as a list of content ids. /// - public ImmutableList? DefaultValue { get; set; } + public ReadonlyList? DefaultValue { get; set; } /// /// The minimum allowed items for the field value. @@ -57,7 +57,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models.Fields /// /// The id of the referenced schemas. /// - public ImmutableList? SchemaIds { get; set; } + public ReadonlyList? SchemaIds { get; set; } public override FieldProperties ToProperties() { diff --git a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/StringFieldPropertiesDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/StringFieldPropertiesDto.cs index da8fb2d8b..8f11b8101 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/StringFieldPropertiesDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/StringFieldPropertiesDto.cs @@ -71,7 +71,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models.Fields /// /// The allowed values for the field value. /// - public ImmutableList? AllowedValues { get; set; } + public ReadonlyList? AllowedValues { get; set; } /// /// Indicates if the field value must be unique. Ignored for nested fields and localized fields. diff --git a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/TagsFieldPropertiesDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/TagsFieldPropertiesDto.cs index ab72def48..8c78eef92 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/TagsFieldPropertiesDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/TagsFieldPropertiesDto.cs @@ -16,12 +16,12 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models.Fields /// /// The language specific default value for the field value. /// - public LocalizedValue?> DefaultValues { get; set; } + public LocalizedValue?> DefaultValues { get; set; } /// /// The default value. /// - public ImmutableList? DefaultValue { get; set; } + public ReadonlyList? DefaultValue { get; set; } /// /// The minimum allowed items for the field value. @@ -36,7 +36,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models.Fields /// /// The allowed values for the field value. /// - public ImmutableList? AllowedValues { get; set; } + public ReadonlyList? AllowedValues { get; set; } /// /// The editor that is used to manage this field. diff --git a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/SchemaDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/SchemaDto.cs index 0b928b20e..7fa62df37 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/SchemaDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/SchemaDto.cs @@ -101,7 +101,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models /// The preview Urls. /// [LocalizedRequired] - public ImmutableDictionary PreviewUrls { get; set; } + public ReadonlyDictionary PreviewUrls { get; set; } /// /// The name of fields that are used in content lists. diff --git a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/SchemaPropertiesDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/SchemaPropertiesDto.cs index 8deab5021..cc03ea6ee 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/SchemaPropertiesDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/SchemaPropertiesDto.cs @@ -47,6 +47,6 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models /// /// Tags for automation processes. /// - public ImmutableList? Tags { get; set; } + public ReadonlyList? Tags { get; set; } } } diff --git a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/UpdateSchemaDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/UpdateSchemaDto.cs index 49695734a..bb2611983 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/UpdateSchemaDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/UpdateSchemaDto.cs @@ -50,7 +50,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models /// /// Tags for automation processes. /// - public ImmutableList? Tags { get; set; } + public ReadonlyList? Tags { get; set; } public UpdateSchema ToCommand() { diff --git a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/UpsertSchemaDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/UpsertSchemaDto.cs index b93e04191..a7a8cf7f0 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/UpsertSchemaDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/UpsertSchemaDto.cs @@ -43,7 +43,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models /// /// The optional preview urls. /// - public ImmutableDictionary? PreviewUrls { get; set; } + public ReadonlyDictionary? PreviewUrls { get; set; } /// /// The optional field Rules. diff --git a/backend/src/Squidex/Config/Domain/AppsServices.cs b/backend/src/Squidex/Config/Domain/AppsServices.cs index f0edc7e68..3cfa22956 100644 --- a/backend/src/Squidex/Config/Domain/AppsServices.cs +++ b/backend/src/Squidex/Config/Domain/AppsServices.cs @@ -80,7 +80,7 @@ namespace Squidex.Config.Domain { Settings = new AppSettings { - Patterns = ImmutableList.ToImmutableList(patterns) + Patterns = ReadonlyList.ToReadonlyList(patterns) } }; }); diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/LanguagesConfigTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/LanguagesConfigTests.cs index 8822804cb..783e55545 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/LanguagesConfigTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/LanguagesConfigTests.cs @@ -115,7 +115,7 @@ namespace Squidex.Domain.Apps.Core.Model.Apps [Language.EN] = new LanguageConfig(), [Language.DE] = new LanguageConfig(), [Language.ES] = new LanguageConfig(true), - [Language.IT] = new LanguageConfig(true, ImmutableList.Create(Language.ES)) + [Language.IT] = new LanguageConfig(true, ReadonlyList.Create(Language.ES)) }); Assert.Equal(Language.DE, config.Master); @@ -255,7 +255,7 @@ namespace Squidex.Domain.Apps.Core.Model.Apps new Dictionary { [Language.EN] = new LanguageConfig(), - [Language.IT] = new LanguageConfig(true, ImmutableList.Create(Language.EN)) + [Language.IT] = new LanguageConfig(true, ReadonlyList.Create(Language.EN)) }); Assert.Equal(Language.EN, config_2.Master); @@ -272,7 +272,7 @@ namespace Squidex.Domain.Apps.Core.Model.Apps new Dictionary { [Language.EN] = new LanguageConfig(), - [Language.IT] = new LanguageConfig(true, ImmutableList.Create(Language.EN)) + [Language.IT] = new LanguageConfig(true, ReadonlyList.Create(Language.EN)) }); Assert.Equal(Language.EN, config_2.Master); diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/WorkflowJsonTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/WorkflowJsonTests.cs index ab97363d8..2ab0996fd 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/WorkflowJsonTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/WorkflowJsonTests.cs @@ -29,11 +29,11 @@ namespace Squidex.Domain.Apps.Core.Model.Contents new Dictionary { [Status.Published] = WorkflowTransition.When("Expression", "Role1", "Role2") - }.ToImmutableDictionary(), + }.ToReadonlyDictionary(), "#00ff00", NoUpdate.When("Expression", "Role1", "Role2")) - }.ToImmutableDictionary(), - ImmutableList.Create(DomainId.NewGuid()), "MyName"); + }.ToReadonlyDictionary(), + ReadonlyList.Create(DomainId.NewGuid()), "MyName"); var serialized = workflow.SerializeAndDeserialize(); diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/WorkflowTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/WorkflowTests.cs index df73daa48..aefaee9e6 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/WorkflowTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/WorkflowTests.cs @@ -25,13 +25,13 @@ namespace Squidex.Domain.Apps.Core.Model.Contents { [Status.Archived] = WorkflowTransition.When("ToArchivedExpr", "ToArchivedRole"), [Status.Published] = WorkflowTransition.When("ToPublishedExpr", "ToPublishedRole") - }.ToImmutableDictionary(), + }.ToReadonlyDictionary(), StatusColors.Draft), [Status.Archived] = new WorkflowStep(), [Status.Published] = new WorkflowStep() - }.ToImmutableDictionary()); + }.ToReadonlyDictionary()); [Fact] public void Should_provide_default_workflow_if_none_found() diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Schemas/FieldCompareTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Schemas/FieldCompareTests.cs index 4f69c8c0d..dd15c826c 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Schemas/FieldCompareTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Schemas/FieldCompareTests.cs @@ -41,17 +41,17 @@ namespace Squidex.Domain.Apps.Core.Model.Schemas { var lhs = new TagsFieldProperties { - DefaultValues = new LocalizedValue?>(new Dictionary?> + DefaultValues = new LocalizedValue?>(new Dictionary?> { - ["iv"] = ImmutableList.Create("A", "B", "C") + ["iv"] = ReadonlyList.Create("A", "B", "C") }) }; var rhs = new TagsFieldProperties { - DefaultValues = new LocalizedValue?>(new Dictionary?> + DefaultValues = new LocalizedValue?>(new Dictionary?> { - ["iv"] = ImmutableList.Create("A", "B", "C") + ["iv"] = ReadonlyList.Create("A", "B", "C") }) }; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Schemas/SchemaTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Schemas/SchemaTests.cs index d3d92f2a3..627e105df 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Schemas/SchemaTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Schemas/SchemaTests.cs @@ -438,11 +438,11 @@ namespace Squidex.Domain.Apps.Core.Model.Schemas var urls1 = new Dictionary { ["web"] = "Url" - }.ToImmutableDictionary(); + }.ToReadonlyDictionary(); var urls2 = new Dictionary { ["web"] = "Url" - }.ToImmutableDictionary(); + }.ToReadonlyDictionary(); var schema_1 = schema_0.SetPreviewUrls(urls1); var schema_2 = schema_1.SetPreviewUrls(urls2); @@ -470,7 +470,7 @@ namespace Squidex.Domain.Apps.Core.Model.Schemas .SetPreviewUrls(new Dictionary { ["web"] = "Url" - }.ToImmutableDictionary()); + }.ToReadonlyDictionary()); var schemaTarget = schemaSource.SerializeAndDeserialize(); diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/DefaultValues/DefaultValuesTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/DefaultValues/DefaultValuesTests.cs index ad0a363c4..83f8f371a 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/DefaultValues/DefaultValuesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/DefaultValues/DefaultValuesTests.cs @@ -96,7 +96,7 @@ namespace Squidex.Domain.Apps.Core.Operations.DefaultValues { var field = Fields.Assets(1, "1", Partitioning.Invariant, - new AssetsFieldProperties { DefaultValue = ImmutableList.Create("1", "2" ) }); + new AssetsFieldProperties { DefaultValue = ReadonlyList.Create("1", "2" ) }); Assert.Equal(JsonValue.Array("1", "2"), DefaultValueFactory.CreateDefaultValue(field, now, language.Iso2Code)); } @@ -108,11 +108,11 @@ namespace Squidex.Domain.Apps.Core.Operations.DefaultValues Fields.Assets(1, "1", Partitioning.Invariant, new AssetsFieldProperties { - DefaultValues = new LocalizedValue?>(new Dictionary?> + DefaultValues = new LocalizedValue?>(new Dictionary?> { [language.Iso2Code] = null }), - DefaultValue = ImmutableList.Create("1", "2") + DefaultValue = ReadonlyList.Create("1", "2") }); Assert.Equal(JsonValue.Array(), DefaultValueFactory.CreateDefaultValue(field, now, language.Iso2Code)); @@ -254,7 +254,7 @@ namespace Squidex.Domain.Apps.Core.Operations.DefaultValues { var field = Fields.References(1, "1", Partitioning.Invariant, - new ReferencesFieldProperties { DefaultValue = ImmutableList.Create("1", "2") }); + new ReferencesFieldProperties { DefaultValue = ReadonlyList.Create("1", "2") }); Assert.Equal(JsonValue.Array("1", "2"), DefaultValueFactory.CreateDefaultValue(field, now, language.Iso2Code)); } @@ -266,11 +266,11 @@ namespace Squidex.Domain.Apps.Core.Operations.DefaultValues Fields.References(1, "1", Partitioning.Invariant, new ReferencesFieldProperties { - DefaultValues = new LocalizedValue?>(new Dictionary?> + DefaultValues = new LocalizedValue?>(new Dictionary?> { [language.Iso2Code] = null }), - DefaultValue = ImmutableList.Create("1", "2") + DefaultValue = ReadonlyList.Create("1", "2") }); Assert.Equal(JsonValue.Array(), DefaultValueFactory.CreateDefaultValue(field, now, language.Iso2Code)); @@ -308,7 +308,7 @@ namespace Squidex.Domain.Apps.Core.Operations.DefaultValues { var field = Fields.Tags(1, "1", Partitioning.Invariant, - new TagsFieldProperties { DefaultValue = ImmutableList.Create("tag1", "tag2") }); + new TagsFieldProperties { DefaultValue = ReadonlyList.Create("tag1", "tag2") }); Assert.Equal(JsonValue.Array("tag1", "tag2"), DefaultValueFactory.CreateDefaultValue(field, now, language.Iso2Code)); } @@ -320,11 +320,11 @@ namespace Squidex.Domain.Apps.Core.Operations.DefaultValues Fields.Tags(1, "1", Partitioning.Invariant, new TagsFieldProperties { - DefaultValues = new LocalizedValue?>(new Dictionary?> + DefaultValues = new LocalizedValue?>(new Dictionary?> { [language.Iso2Code] = null }), - DefaultValue = ImmutableList.Create("tag1", "tag2") + DefaultValue = ReadonlyList.Create("tag1", "tag2") }); Assert.Equal(JsonValue.Array(), DefaultValueFactory.CreateDefaultValue(field, now, language.Iso2Code)); diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/EventSynchronization/SchemaSynchronizerTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/EventSynchronization/SchemaSynchronizerTests.cs index 81121aff1..58663521d 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/EventSynchronization/SchemaSynchronizerTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/EventSynchronization/SchemaSynchronizerTests.cs @@ -89,7 +89,7 @@ namespace Squidex.Domain.Apps.Core.Operations.EventSynchronization var previewUrls = new Dictionary { ["web"] = "Url" - }.ToImmutableDictionary(); + }.ToReadonlyDictionary(); var sourceSchema = new Schema("source"); diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ArrayFieldTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ArrayFieldTests.cs index 376788ed3..cbc40fb1c 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ArrayFieldTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ArrayFieldTests.cs @@ -61,7 +61,7 @@ namespace Squidex.Domain.Apps.Core.Operations.ValidateContent [Fact] public async Task Should_not_add_error_if_value_has_not_duplicates() { - var sut = Field(new ArrayFieldProperties { UniqueFields = ImmutableList.Create("myString") }); + var sut = Field(new ArrayFieldProperties { UniqueFields = ReadonlyList.Create("myString") }); await sut.ValidateAsync(CreateValue(Object("myString", "1"), Object("myString", "2")), errors); @@ -126,7 +126,7 @@ namespace Squidex.Domain.Apps.Core.Operations.ValidateContent [Fact] public async Task Should_add_error_if_value_has_duplicates() { - var sut = Field(new ArrayFieldProperties { UniqueFields = ImmutableList.Create("myString") }); + var sut = Field(new ArrayFieldProperties { UniqueFields = ReadonlyList.Create("myString") }); await sut.ValidateAsync(CreateValue(Object("myString", "1"), Object("myString", "1")), errors); diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ComponentFieldTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ComponentFieldTests.cs index d20736286..45f30e9ef 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ComponentFieldTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ComponentFieldTests.cs @@ -88,7 +88,7 @@ namespace Squidex.Domain.Apps.Core.Operations.ValidateContent [Fact] public async Task Should_add_error_if_value_has_no_discriminator() { - var (_, sut, components) = Field(new ComponentFieldProperties { SchemaIds = ImmutableList.Create(schemaId1, schemaId2) }); + var (_, sut, components) = Field(new ComponentFieldProperties { SchemaIds = ReadonlyList.Create(schemaId1, schemaId2) }); await sut.ValidateAsync(CreateValue(null, "field", 1), errors, components: components); diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ComponentsFieldTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ComponentsFieldTests.cs index 962eee475..421c73422 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ComponentsFieldTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ComponentsFieldTests.cs @@ -109,7 +109,7 @@ namespace Squidex.Domain.Apps.Core.Operations.ValidateContent [Fact] public async Task Should_add_error_if_component_has_no_discriminator() { - var (_, sut, components) = Field(new ComponentsFieldProperties { SchemaIds = ImmutableList.Create(schemaId1, schemaId2) }); + var (_, sut, components) = Field(new ComponentsFieldProperties { SchemaIds = ReadonlyList.Create(schemaId1, schemaId2) }); await sut.ValidateAsync(CreateValue(1, null, "field", 1), errors, components: components); @@ -164,7 +164,7 @@ namespace Squidex.Domain.Apps.Core.Operations.ValidateContent [Fact] public async Task Should_add_error_if_value_has_duplicates() { - var (id, sut, components) = Field(new ComponentsFieldProperties { UniqueFields = ImmutableList.Create("componentField") }); + var (id, sut, components) = Field(new ComponentsFieldProperties { UniqueFields = ReadonlyList.Create("componentField") }); await sut.ValidateAsync(CreateValue(2, id.ToString(), "componentField", 1), errors, components: components); diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/NumberFieldTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/NumberFieldTests.cs index 89934bde0..f46c8a869 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/NumberFieldTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/NumberFieldTests.cs @@ -74,7 +74,7 @@ namespace Squidex.Domain.Apps.Core.Operations.ValidateContent [Fact] public async Task Should_add_error_if_number_is_not_allowed() { - var sut = Field(new NumberFieldProperties { AllowedValues = ImmutableList.Create(10d) }); + var sut = Field(new NumberFieldProperties { AllowedValues = ReadonlyList.Create(10d) }); await sut.ValidateAsync(CreateValue(20), errors); diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/StringFieldTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/StringFieldTests.cs index 6c368d793..6a2b2803e 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/StringFieldTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/StringFieldTests.cs @@ -107,7 +107,7 @@ namespace Squidex.Domain.Apps.Core.Operations.ValidateContent [Fact] public async Task Should_add_error_if_string_not_allowed() { - var sut = Field(new StringFieldProperties { AllowedValues = ImmutableList.Create("Foo") }); + var sut = Field(new StringFieldProperties { AllowedValues = ReadonlyList.Create("Foo") }); await sut.ValidateAsync(CreateValue("Bar"), errors); diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/TagsFieldTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/TagsFieldTests.cs index 9b4746f2e..ab60926d8 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/TagsFieldTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/TagsFieldTests.cs @@ -139,7 +139,7 @@ namespace Squidex.Domain.Apps.Core.Operations.ValidateContent [Fact] public async Task Should_add_error_if_value_contains_an_not_allowed_values() { - var sut = Field(new TagsFieldProperties { AllowedValues = ImmutableList.Create("tag-2", "tag-3") }); + var sut = Field(new TagsFieldProperties { AllowedValues = ReadonlyList.Create("tag-2", "tag-3") }); await sut.ValidateAsync(CreateValue("tag-1", "tag-2", null), errors); diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/AssetsValidatorTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/AssetsValidatorTests.cs index 9a8e8874b..cd0db5ed3 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/AssetsValidatorTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/AssetsValidatorTests.cs @@ -238,7 +238,7 @@ namespace Squidex.Domain.Apps.Core.Operations.ValidateContent.Validators [Fact] public async Task Should_add_error_if_image_has_invalid_extension() { - var sut = Validator(new AssetsFieldProperties { AllowedExtensions = ImmutableList.Create("mp4") }); + var sut = Validator(new AssetsFieldProperties { AllowedExtensions = ReadonlyList.Create("mp4") }); await sut.ValidateAsync(CreateValue(Document.AssetId, Image1.AssetId), errors); diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/TestHelpers/TestUtils.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/TestHelpers/TestUtils.cs index 03b275a7e..2ac83b295 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/TestHelpers/TestUtils.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/TestHelpers/TestUtils.cs @@ -117,7 +117,7 @@ namespace Squidex.Domain.Apps.Core.TestHelpers .AddReferences(109, "root-references", Partitioning.Invariant, new ReferencesFieldProperties()) .AddString(110, "root-string1", Partitioning.Invariant, - new StringFieldProperties { Label = "My String1", IsRequired = true, AllowedValues = ImmutableList.Create("a", "b") }) + new StringFieldProperties { Label = "My String1", IsRequired = true, AllowedValues = ReadonlyList.Create("a", "b") }) .AddString(111, "root-string2", Partitioning.Invariant, new StringFieldProperties { Hints = "My String1" }) .AddTags(112, "root-tags", Partitioning.Language, diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppTests.cs index ffff81326..842f7b618 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppTests.cs @@ -159,7 +159,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.DomainObject.Guards { Settings = new AppSettings { - Patterns = ImmutableList.Create( + Patterns = ReadonlyList.Create( new Pattern(null!, "[a-z]")) } }; @@ -175,7 +175,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.DomainObject.Guards { Settings = new AppSettings { - Patterns = ImmutableList.Create( + Patterns = ReadonlyList.Create( new Pattern("name", null!)) } }; @@ -206,7 +206,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.DomainObject.Guards { Settings = new AppSettings { - Editors = ImmutableList.Create( + Editors = ReadonlyList.Create( new Editor(null!, "[a-z]")) } }; @@ -222,7 +222,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.DomainObject.Guards { Settings = new AppSettings { - Editors = ImmutableList.Create( + Editors = ReadonlyList.Create( new Editor("name", null!)) } }; @@ -238,9 +238,9 @@ namespace Squidex.Domain.Apps.Entities.Apps.DomainObject.Guards { Settings = new AppSettings { - Patterns = ImmutableList.Create( + Patterns = ReadonlyList.Create( new Pattern("name", "[a-z]")), - Editors = ImmutableList.Create( + Editors = ReadonlyList.Create( new Editor("name", "url/to/editor")) } }; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppWorkflowTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppWorkflowTests.cs index 907f2cb3b..ebbbd5753 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppWorkflowTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppWorkflowTests.cs @@ -76,7 +76,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.DomainObject.Guards new Dictionary { [Status.Published] = new WorkflowStep() - }.ToImmutableDictionary()), + }.ToReadonlyDictionary()), WorkflowId = workflowId }; @@ -94,7 +94,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.DomainObject.Guards new Dictionary { [Status.Published] = new WorkflowStep() - }.ToImmutableDictionary()), + }.ToReadonlyDictionary()), WorkflowId = workflowId }; @@ -112,7 +112,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.DomainObject.Guards new Dictionary { [Status.Draft] = new WorkflowStep() - }.ToImmutableDictionary()), + }.ToReadonlyDictionary()), WorkflowId = workflowId }; @@ -131,7 +131,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.DomainObject.Guards { [Status.Published] = null!, [Status.Draft] = new WorkflowStep() - }.ToImmutableDictionary()), + }.ToReadonlyDictionary()), WorkflowId = workflowId }; @@ -153,9 +153,9 @@ namespace Squidex.Domain.Apps.Entities.Apps.DomainObject.Guards new Dictionary { [Status.Archived] = WorkflowTransition.Always - }.ToImmutableDictionary()), + }.ToReadonlyDictionary()), [Status.Draft] = new WorkflowStep() - }.ToImmutableDictionary()), + }.ToReadonlyDictionary()), WorkflowId = workflowId }; @@ -179,8 +179,8 @@ namespace Squidex.Domain.Apps.Entities.Apps.DomainObject.Guards new Dictionary { [Status.Draft] = null! - }.ToImmutableDictionary()) - }.ToImmutableDictionary()), + }.ToReadonlyDictionary()) + }.ToReadonlyDictionary()), WorkflowId = workflowId }; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ContentChangedTriggerHandlerTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ContentChangedTriggerHandlerTests.cs index 474142d46..27f0df0ce 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ContentChangedTriggerHandlerTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ContentChangedTriggerHandlerTests.cs @@ -152,7 +152,7 @@ namespace Squidex.Domain.Apps.Entities.Contents { var trigger = new ContentChangedTriggerV2 { - Schemas = ImmutableList.Create( + Schemas = ReadonlyList.Create( new ContentChangedTriggerSchemaV2 { SchemaId = schemaMatch.Id @@ -361,7 +361,7 @@ namespace Squidex.Domain.Apps.Entities.Contents { trigger = trigger with { - Schemas = ImmutableList.Create( + Schemas = ReadonlyList.Create( new ContentChangedTriggerSchemaV2 { SchemaId = schemaId.Id, Condition = condition diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DefaultWorkflowsValidatorTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DefaultWorkflowsValidatorTests.cs index 12f78f4a1..236608429 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DefaultWorkflowsValidatorTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DefaultWorkflowsValidatorTests.cs @@ -60,8 +60,8 @@ namespace Squidex.Domain.Apps.Entities.Contents var workflows = Workflows.Empty .Add(id1, "workflow1") .Add(id2, "workflow2") - .Update(id1, new Workflow(default, null, ImmutableList.Create(schemaId.Id))) - .Update(id2, new Workflow(default, null, ImmutableList.Create(schemaId.Id))); + .Update(id1, new Workflow(default, null, ReadonlyList.Create(schemaId.Id))) + .Update(id2, new Workflow(default, null, ReadonlyList.Create(schemaId.Id))); var errors = await sut.ValidateAsync(appId.Id, workflows); @@ -79,8 +79,8 @@ namespace Squidex.Domain.Apps.Entities.Contents var workflows = Workflows.Empty .Add(id1, "workflow1") .Add(id2, "workflow2") - .Update(id1, new Workflow(default, null, ImmutableList.Create(oldSchemaId))) - .Update(id2, new Workflow(default, null, ImmutableList.Create(oldSchemaId))); + .Update(id1, new Workflow(default, null, ReadonlyList.Create(oldSchemaId))) + .Update(id2, new Workflow(default, null, ReadonlyList.Create(oldSchemaId))); var errors = await sut.ValidateAsync(appId.Id, workflows); @@ -96,7 +96,7 @@ namespace Squidex.Domain.Apps.Entities.Contents var workflows = Workflows.Empty .Add(id1, "workflow1") .Add(id2, "workflow2") - .Update(id1, new Workflow(default, null, ImmutableList.Create(schemaId.Id))); + .Update(id1, new Workflow(default, null, ReadonlyList.Create(schemaId.Id))); var errors = await sut.ValidateAsync(appId.Id, workflows); diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DynamicContentWorkflowTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DynamicContentWorkflowTests.cs index 0ddeee58c..c208a3c42 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DynamicContentWorkflowTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DynamicContentWorkflowTests.cs @@ -40,7 +40,7 @@ namespace Squidex.Domain.Apps.Entities.Contents new Dictionary { [Status.Draft] = WorkflowTransition.Always - }.ToImmutableDictionary(), + }.ToReadonlyDictionary(), StatusColors.Archived, NoUpdate.Always), [Status.Draft] = new WorkflowStep( @@ -48,7 +48,7 @@ namespace Squidex.Domain.Apps.Entities.Contents { [Status.Archived] = WorkflowTransition.Always, [Status.Published] = WorkflowTransition.When("data.field.iv === 2", "Editor") - }.ToImmutableDictionary(), + }.ToReadonlyDictionary(), StatusColors.Draft), [Status.Published] = new WorkflowStep( @@ -56,9 +56,9 @@ namespace Squidex.Domain.Apps.Entities.Contents { [Status.Archived] = WorkflowTransition.Always, [Status.Draft] = WorkflowTransition.Always - }.ToImmutableDictionary(), + }.ToReadonlyDictionary(), StatusColors.Published, NoUpdate.When("data.field.iv === 2", "Owner", "Editor")) - }.ToImmutableDictionary()); + }.ToReadonlyDictionary()); public DynamicContentWorkflowTests() { @@ -73,17 +73,17 @@ namespace Squidex.Domain.Apps.Entities.Contents new Dictionary { [Status.Published] = WorkflowTransition.Always - }.ToImmutableDictionary(), + }.ToReadonlyDictionary(), StatusColors.Draft), [Status.Published] = new WorkflowStep( new Dictionary { [Status.Draft] = WorkflowTransition.Always - }.ToImmutableDictionary(), + }.ToReadonlyDictionary(), StatusColors.Published) - }.ToImmutableDictionary(), - ImmutableList.Create(simpleSchemaId.Id)); + }.ToReadonlyDictionary(), + ReadonlyList.Create(simpleSchemaId.Id)); var workflows = Workflows.Empty.Set(workflow).Set(DomainId.NewGuid(), simpleWorkflow); diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/TestSchemas.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/TestSchemas.cs index 07fdd7d46..f612e7e9f 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/TestSchemas.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/TestSchemas.cs @@ -62,7 +62,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL .AddComponent(11, "my-component", Partitioning.Invariant, new ComponentFieldProperties { SchemaId = Ref1Id.Id }) .AddComponents(12, "my-components", Partitioning.Invariant, - new ComponentsFieldProperties { SchemaIds = ImmutableList.Create(Ref1.Id, Ref2.Id) }) + new ComponentsFieldProperties { SchemaIds = ReadonlyList.Create(Ref1.Id, Ref2.Id) }) .AddTags(13, "my-tags", Partitioning.Invariant, new TagsFieldProperties()) .AddArray(100, "my-array", Partitioning.Invariant, f => f diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/Guards/GuardRuleTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/Guards/GuardRuleTests.cs index 621cabbe4..ce3a666aa 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/Guards/GuardRuleTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/Guards/GuardRuleTests.cs @@ -61,7 +61,7 @@ namespace Squidex.Domain.Apps.Entities.Rules.DomainObject.Guards { Trigger = new ContentChangedTriggerV2 { - Schemas = ImmutableList.Empty() + Schemas = ReadonlyList.Empty() }, Action = null!, }); @@ -77,7 +77,7 @@ namespace Squidex.Domain.Apps.Entities.Rules.DomainObject.Guards { Trigger = new ContentChangedTriggerV2 { - Schemas = ImmutableList.Empty() + Schemas = ReadonlyList.Empty() }, Action = new TestAction { @@ -111,7 +111,7 @@ namespace Squidex.Domain.Apps.Entities.Rules.DomainObject.Guards { Trigger = new ContentChangedTriggerV2 { - Schemas = ImmutableList.Empty() + Schemas = ReadonlyList.Empty() }, Action = new TestAction { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/Guards/Triggers/ContentChangedTriggerTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/Guards/Triggers/ContentChangedTriggerTests.cs index 6f9ffc95c..433f368f7 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/Guards/Triggers/ContentChangedTriggerTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/Guards/Triggers/ContentChangedTriggerTests.cs @@ -31,7 +31,7 @@ namespace Squidex.Domain.Apps.Entities.Rules.DomainObject.Guards.Triggers { var trigger = new ContentChangedTriggerV2 { - Schemas = ImmutableList.Create(new ContentChangedTriggerSchemaV2()) + Schemas = ReadonlyList.Create(new ContentChangedTriggerSchemaV2()) }; var errors = await RuleTriggerValidator.ValidateAsync(appId.Id, trigger, appProvider); @@ -54,7 +54,7 @@ namespace Squidex.Domain.Apps.Entities.Rules.DomainObject.Guards.Triggers var trigger = new ContentChangedTriggerV2 { - Schemas = ImmutableList.Create(new ContentChangedTriggerSchemaV2 { SchemaId = schemaId.Id }) + Schemas = ReadonlyList.Create(new ContentChangedTriggerSchemaV2 { SchemaId = schemaId.Id }) }; var errors = await RuleTriggerValidator.ValidateAsync(appId.Id, trigger, appProvider); @@ -81,7 +81,7 @@ namespace Squidex.Domain.Apps.Entities.Rules.DomainObject.Guards.Triggers { var trigger = new ContentChangedTriggerV2 { - Schemas = ImmutableList.Empty() + Schemas = ReadonlyList.Empty() }; var errors = await RuleTriggerValidator.ValidateAsync(appId.Id, trigger, appProvider); @@ -97,7 +97,7 @@ namespace Squidex.Domain.Apps.Entities.Rules.DomainObject.Guards.Triggers var trigger = new ContentChangedTriggerV2 { - Schemas = ImmutableList.Create(new ContentChangedTriggerSchemaV2 { SchemaId = schemaId.Id }) + Schemas = ReadonlyList.Create(new ContentChangedTriggerSchemaV2 { SchemaId = schemaId.Id }) }; var errors = await RuleTriggerValidator.ValidateAsync(appId.Id, trigger, appProvider); diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/NumberFieldPropertiesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/NumberFieldPropertiesTests.cs index a543da36c..496c8b29b 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/NumberFieldPropertiesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/NumberFieldPropertiesTests.cs @@ -79,7 +79,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards.FieldProperti [InlineData(NumberFieldEditor.Radio)] public void Should_add_error_if_inline_editing_is_not_allowed_for_editor(NumberFieldEditor editor) { - var sut = new NumberFieldProperties { InlineEditable = true, Editor = editor, AllowedValues = ImmutableList.Create(1.0) }; + var sut = new NumberFieldProperties { InlineEditable = true, Editor = editor, AllowedValues = ReadonlyList.Create(1.0) }; var errors = FieldPropertiesValidator.Validate(sut).ToList(); @@ -96,7 +96,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards.FieldProperti [InlineData(NumberFieldEditor.Stars)] public void Should_not_add_error_if_inline_editing_is_allowed_for_editor(NumberFieldEditor editor) { - var sut = new NumberFieldProperties { InlineEditable = true, Editor = editor, AllowedValues = ImmutableList.Create(1.0) }; + var sut = new NumberFieldProperties { InlineEditable = true, Editor = editor, AllowedValues = ReadonlyList.Create(1.0) }; var errors = FieldPropertiesValidator.Validate(sut).ToList(); diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/StringFieldPropertiesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/StringFieldPropertiesTests.cs index 2d75f08f4..aa9ed169a 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/StringFieldPropertiesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/StringFieldPropertiesTests.cs @@ -153,7 +153,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards.FieldProperti [InlineData(StringFieldEditor.TextArea)] public void Should_add_error_if_inline_editing_is_not_allowed_for_editor(StringFieldEditor editor) { - var sut = new StringFieldProperties { InlineEditable = true, Editor = editor, AllowedValues = ImmutableList.Create("Value") }; + var sut = new StringFieldProperties { InlineEditable = true, Editor = editor, AllowedValues = ReadonlyList.Create("Value") }; var errors = FieldPropertiesValidator.Validate(sut).ToList(); @@ -170,7 +170,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards.FieldProperti [InlineData(StringFieldEditor.Slug)] public void Should_not_add_error_if_inline_editing_is_allowed_for_editor(StringFieldEditor editor) { - var sut = new StringFieldProperties { InlineEditable = true, Editor = editor, AllowedValues = ImmutableList.Create("Value") }; + var sut = new StringFieldProperties { InlineEditable = true, Editor = editor, AllowedValues = ReadonlyList.Create("Value") }; var errors = FieldPropertiesValidator.Validate(sut).ToList(); diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/GuardSchemaTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/GuardSchemaTests.cs index 538a184e3..83ba06d30 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/GuardSchemaTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/GuardSchemaTests.cs @@ -657,7 +657,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards [Fact] public void CanConfigurePreviewUrls_should_not_throw_exception_if_valid() { - var command = new ConfigurePreviewUrls { PreviewUrls = ImmutableDictionary.Empty() }; + var command = new ConfigurePreviewUrls { PreviewUrls = ReadonlyDictionary.Empty() }; GuardSchema.CanConfigurePreviewUrls(command); } diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/SchemaDomainObjectTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/SchemaDomainObjectTests.cs index b6942f130..01757697e 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/SchemaDomainObjectTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/SchemaDomainObjectTests.cs @@ -293,7 +293,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject PreviewUrls = new Dictionary { ["Web"] = "web-url" - }.ToImmutableDictionary() + }.ToReadonlyDictionary() }; await ExecuteCreateAsync(); diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/SchemaCommandsTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/SchemaCommandsTests.cs index defb9451a..adbb72f01 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/SchemaCommandsTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/SchemaCommandsTests.cs @@ -48,7 +48,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas PreviewUrls = new Dictionary { ["mobile"] = "http://mobile" - }.ToImmutableDictionary(), + }.ToReadonlyDictionary(), Category = "myCategory" }; @@ -70,7 +70,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas .SetPreviewUrls(new Dictionary { ["mobile"] = "http://mobile" - }.ToImmutableDictionary()) + }.ToReadonlyDictionary()) .Publish(); var actual = command.BuildSchema("my-schema", SchemaType.Default); diff --git a/backend/tests/Squidex.Infrastructure.Tests/Collections/ImmutableDictionaryTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Collections/ReadonlyDictionaryTests.cs similarity index 78% rename from backend/tests/Squidex.Infrastructure.Tests/Collections/ImmutableDictionaryTests.cs rename to backend/tests/Squidex.Infrastructure.Tests/Collections/ReadonlyDictionaryTests.cs index 7874be4d7..65321a8ff 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Collections/ImmutableDictionaryTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Collections/ReadonlyDictionaryTests.cs @@ -12,30 +12,30 @@ using Xunit; namespace Squidex.Infrastructure.Collections { - public class ImmutableDictionaryTests + public class ReadonlyDictionaryTests { [Fact] public void Should_return_empty_instance_for_empty_source() { - var result = new Dictionary().ToImmutableDictionary(); + var result = new Dictionary().ToReadonlyDictionary(); - Assert.Same(ImmutableDictionary.Empty(), result); + Assert.Same(ReadonlyDictionary.Empty(), result); } [Fact] public void Should_return_empty_instance_for_empty_source_and_key_selector() { - var result = Enumerable.Empty().ToImmutableDictionary(x => x); + var result = Enumerable.Empty().ToReadonlyDictionary(x => x); - Assert.Same(ImmutableDictionary.Empty(), result); + Assert.Same(ReadonlyDictionary.Empty(), result); } [Fact] public void Should_return_empty_instance_for_empty_source_and_value_selector() { - var result = Enumerable.Empty().ToImmutableDictionary(x => x, x => x); + var result = Enumerable.Empty().ToReadonlyDictionary(x => x, x => x); - Assert.Same(ImmutableDictionary.Empty(), result); + Assert.Same(ReadonlyDictionary.Empty(), result); } [Fact] @@ -44,28 +44,28 @@ namespace Squidex.Infrastructure.Collections var obj1a = new Dictionary { [1] = 1 - }.ToImmutableDictionary(); + }.ToReadonlyDictionary(); var obj1b = new Dictionary { [1] = 1 - }.ToImmutableDictionary(); + }.ToReadonlyDictionary(); var dictionaryOtherValue = new Dictionary { [1] = 2 - }.ToImmutableDictionary(); + }.ToReadonlyDictionary(); var dictionaryOtherKey = new Dictionary { [2] = 1 - }.ToImmutableDictionary(); + }.ToReadonlyDictionary(); var dictionaryOtherCount = new Dictionary { [1] = 1, [2] = 2 - }.ToImmutableDictionary(); + }.ToReadonlyDictionary(); Assert.Equal(obj1a, obj1b); Assert.Equal(obj1a.GetHashCode(), obj1b.GetHashCode()); @@ -92,7 +92,7 @@ namespace Squidex.Infrastructure.Collections [11] = 1, [12] = 2, [13] = 3 - }.ToImmutableDictionary(); + }.ToReadonlyDictionary(); var serialized = sut.SerializeAndDeserialize(); diff --git a/backend/tests/Squidex.Infrastructure.Tests/Collections/ImmutableListTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Collections/ReadonlyListTests.cs similarity index 71% rename from backend/tests/Squidex.Infrastructure.Tests/Collections/ImmutableListTests.cs rename to backend/tests/Squidex.Infrastructure.Tests/Collections/ReadonlyListTests.cs index 0f8075806..8981b4f2f 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Collections/ImmutableListTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Collections/ReadonlyListTests.cs @@ -11,40 +11,40 @@ using Xunit; namespace Squidex.Infrastructure.Collections { - public class ImmutableListTests + public class ReadonlyListTests { [Fact] public void Should_return_empty_instance_for_empty_array() { - var result = ImmutableList.Create(); + var result = ReadonlyList.Create(); - Assert.Same(ImmutableList.Empty(), result); + Assert.Same(ReadonlyList.Empty(), result); } [Fact] public void Should_return_empty_instance_for_null_array() { - var result = ImmutableList.Create((int[]?)null); + var result = ReadonlyList.Create((int[]?)null); - Assert.Same(ImmutableList.Empty(), result); + Assert.Same(ReadonlyList.Empty(), result); } [Fact] public void Should_return_empty_instance_for_empty_enumerable() { - var result = Enumerable.Empty().ToImmutableList(); + var result = Enumerable.Empty().ToReadonlyList(); - Assert.Same(ImmutableList.Empty(), result); + Assert.Same(ReadonlyList.Empty(), result); } [Fact] public void Should_make_correct_equal_comparisons() { - var list1a = ImmutableList.Create(1); - var list1b = ImmutableList.Create(1); + var list1a = ReadonlyList.Create(1); + var list1b = ReadonlyList.Create(1); - var listOtherValue = ImmutableList.Create(2); - var listOtherSize = ImmutableList.Create(1, 2); + var listOtherValue = ReadonlyList.Create(2); + var listOtherSize = ReadonlyList.Create(1, 2); Assert.Equal(list1a, list1b); Assert.Equal(list1a.GetHashCode(), list1b.GetHashCode()); @@ -62,7 +62,7 @@ namespace Squidex.Infrastructure.Collections [Fact] public void Should_serialize_and_deserialize() { - var sut = ImmutableList.Create(1, 2, 3); + var sut = ReadonlyList.Create(1, 2, 3); var serialized = sut.SerializeAndDeserialize();