Browse Source

Fix naming.

pull/773/head
Sebastian 4 years ago
parent
commit
5f6ad4f0a5
  1. 2
      backend/src/Migrations/OldEvents/AppPatternAdded.cs
  2. 2
      backend/src/Migrations/OldEvents/AppPatternUpdated.cs
  3. 4
      backend/src/Migrations/OldTriggers/ContentChangedTrigger.cs
  4. 2
      backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppClients.cs
  5. 2
      backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppContributors.cs
  6. 4
      backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppSettings.cs
  7. 2
      backend/src/Squidex.Domain.Apps.Core.Model/Apps/Json/LanguageConfigSurrogate.cs
  8. 6
      backend/src/Squidex.Domain.Apps.Core.Model/Apps/LanguageConfig.cs
  9. 2
      backend/src/Squidex.Domain.Apps.Core.Model/Apps/LanguagesConfig.cs
  10. 16
      backend/src/Squidex.Domain.Apps.Core.Model/Apps/Roles.cs
  11. 2
      backend/src/Squidex.Domain.Apps.Core.Model/Contents/Json/WorkflowStepSurrogate.cs
  12. 2
      backend/src/Squidex.Domain.Apps.Core.Model/Contents/NoUpdate.cs
  13. 16
      backend/src/Squidex.Domain.Apps.Core.Model/Contents/Workflow.cs
  14. 2
      backend/src/Squidex.Domain.Apps.Core.Model/Contents/WorkflowCondition.cs
  15. 4
      backend/src/Squidex.Domain.Apps.Core.Model/Contents/WorkflowStep.cs
  16. 2
      backend/src/Squidex.Domain.Apps.Core.Model/Contents/WorkflowTransition.cs
  17. 2
      backend/src/Squidex.Domain.Apps.Core.Model/Contents/Workflows.cs
  18. 2
      backend/src/Squidex.Domain.Apps.Core.Model/Rules/Triggers/ContentChangedTriggerV2.cs
  19. 2
      backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ArrayFieldProperties.cs
  20. 6
      backend/src/Squidex.Domain.Apps.Core.Model/Schemas/AssetsFieldProperties.cs
  21. 4
      backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ComponentFieldProperties.cs
  22. 6
      backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ComponentsFieldProperties.cs
  23. 2
      backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldExtensions.cs
  24. 2
      backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldNames.cs
  25. 2
      backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldProperties.cs
  26. 2
      backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldRules.cs
  27. 2
      backend/src/Squidex.Domain.Apps.Core.Model/Schemas/Json/SchemaSurrogate.cs
  28. 2
      backend/src/Squidex.Domain.Apps.Core.Model/Schemas/LocalizedValue.cs
  29. 2
      backend/src/Squidex.Domain.Apps.Core.Model/Schemas/NumberFieldProperties.cs
  30. 8
      backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ReferencesFieldProperties.cs
  31. 2
      backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ResolvedComponents.cs
  32. 6
      backend/src/Squidex.Domain.Apps.Core.Model/Schemas/Schema.cs
  33. 2
      backend/src/Squidex.Domain.Apps.Core.Model/Schemas/SchemaProperties.cs
  34. 2
      backend/src/Squidex.Domain.Apps.Core.Model/Schemas/StringFieldProperties.cs
  35. 6
      backend/src/Squidex.Domain.Apps.Core.Model/Schemas/TagsFieldProperties.cs
  36. 2
      backend/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/JsonTypeVisitor.cs
  37. 4
      backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/JsonValueConverter.cs
  38. 2
      backend/src/Squidex.Domain.Apps.Entities/AppProviderExtensions.cs
  39. 2
      backend/src/Squidex.Domain.Apps.Entities/Apps/Templates/CreateProfile.cs
  40. 2
      backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ComponentUnionGraphType.cs
  41. 4
      backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/FieldVisitor.cs
  42. 2
      backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ReferenceUnionGraphType.cs
  43. 2
      backend/src/Squidex.Domain.Apps.Entities/Schemas/Commands/ConfigurePreviewUrls.cs
  44. 2
      backend/src/Squidex.Domain.Apps.Entities/Schemas/Commands/CreateSchema.cs
  45. 2
      backend/src/Squidex.Domain.Apps.Entities/Schemas/Commands/IUpsertCommand.cs
  46. 2
      backend/src/Squidex.Domain.Apps.Entities/Schemas/Commands/SynchronizeSchema.cs
  47. 2
      backend/src/Squidex.Domain.Apps.Events/Schemas/SchemaPreviewUrlsConfigured.cs
  48. 18
      backend/src/Squidex.Infrastructure/Collections/ReadonlyDictionary.cs
  49. 10
      backend/src/Squidex.Infrastructure/Collections/ReadonlyDictionary{TKey,TValue}.cs
  50. 14
      backend/src/Squidex.Infrastructure/Collections/ReadonlyList.cs
  51. 10
      backend/src/Squidex.Infrastructure/Collections/ReadonlyList{T}.cs
  52. 2
      backend/src/Squidex.Infrastructure/Queries/PropertyPath.cs
  53. 2
      backend/src/Squidex.Infrastructure/Security/PermissionSet.cs
  54. 4
      backend/src/Squidex/Areas/Api/Config/OpenApi/ReflectionServices.cs
  55. 4
      backend/src/Squidex/Areas/Api/Controllers/Apps/Models/UpdateAppSettingsDto.cs
  56. 4
      backend/src/Squidex/Areas/Api/Controllers/Apps/Models/UpdateWorkflowDto.cs
  57. 2
      backend/src/Squidex/Areas/Api/Controllers/Apps/Models/WorkflowDto.cs
  58. 2
      backend/src/Squidex/Areas/Api/Controllers/Apps/Models/WorkflowStepDto.cs
  59. 2
      backend/src/Squidex/Areas/Api/Controllers/Assets/AssetFoldersController.cs
  60. 2
      backend/src/Squidex/Areas/Api/Controllers/Rules/Models/Triggers/ContentChangedRuleTriggerDto.cs
  61. 2
      backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/ConfigurePreviewUrlsDto.cs
  62. 2
      backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/FieldPropertiesDto.cs
  63. 2
      backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/ArrayFieldPropertiesDto.cs
  64. 6
      backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/AssetsFieldPropertiesDto.cs
  65. 2
      backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/ComponentFieldPropertiesDto.cs
  66. 4
      backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/ComponentsFieldPropertiesDto.cs
  67. 2
      backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/NumberFieldPropertiesDto.cs
  68. 6
      backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/ReferencesFieldPropertiesDto.cs
  69. 2
      backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/StringFieldPropertiesDto.cs
  70. 6
      backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/TagsFieldPropertiesDto.cs
  71. 2
      backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/SchemaDto.cs
  72. 2
      backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/SchemaPropertiesDto.cs
  73. 2
      backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/UpdateSchemaDto.cs
  74. 2
      backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/UpsertSchemaDto.cs
  75. 2
      backend/src/Squidex/Config/Domain/AppsServices.cs
  76. 6
      backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/LanguagesConfigTests.cs
  77. 6
      backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/WorkflowJsonTests.cs
  78. 4
      backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/WorkflowTests.cs
  79. 8
      backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Schemas/FieldCompareTests.cs
  80. 6
      backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Schemas/SchemaTests.cs
  81. 18
      backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/DefaultValues/DefaultValuesTests.cs
  82. 2
      backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/EventSynchronization/SchemaSynchronizerTests.cs
  83. 4
      backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ArrayFieldTests.cs
  84. 2
      backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ComponentFieldTests.cs
  85. 4
      backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ComponentsFieldTests.cs
  86. 2
      backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/NumberFieldTests.cs
  87. 2
      backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/StringFieldTests.cs
  88. 2
      backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/TagsFieldTests.cs
  89. 2
      backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/AssetsValidatorTests.cs
  90. 2
      backend/tests/Squidex.Domain.Apps.Core.Tests/TestHelpers/TestUtils.cs
  91. 12
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppTests.cs
  92. 16
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppWorkflowTests.cs
  93. 4
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ContentChangedTriggerHandlerTests.cs
  94. 10
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DefaultWorkflowsValidatorTests.cs
  95. 16
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DynamicContentWorkflowTests.cs
  96. 2
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/TestSchemas.cs
  97. 6
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/Guards/GuardRuleTests.cs
  98. 8
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/Guards/Triggers/ContentChangedTriggerTests.cs
  99. 4
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/NumberFieldPropertiesTests.cs
  100. 4
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/StringFieldPropertiesTests.cs

2
backend/src/Migrations/OldEvents/AppPatternAdded.cs

@ -36,7 +36,7 @@ namespace Migrations.OldEvents
{
var newSettings = new AppSettings
{
Patterns = ImmutableList.ToImmutableList(new List<Pattern>(state.Settings.Patterns.Where(x => x.Name != Name || x.Regex != Pattern))
Patterns = ReadonlyList.ToReadonlyList(new List<Pattern>(state.Settings.Patterns.Where(x => x.Name != Name || x.Regex != Pattern))
{
new Pattern(Name, Pattern)
{

2
backend/src/Migrations/OldEvents/AppPatternUpdated.cs

@ -36,7 +36,7 @@ namespace Migrations.OldEvents
{
var newSettings = new AppSettings
{
Patterns = ImmutableList.ToImmutableList(new List<Pattern>(state.Settings.Patterns.Where(x => x.Name != Name || x.Regex != Pattern))
Patterns = ReadonlyList.ToReadonlyList(new List<Pattern>(state.Settings.Patterns.Where(x => x.Name != Name || x.Regex != Pattern))
{
new Pattern(Name, Pattern)
{

4
backend/src/Migrations/OldTriggers/ContentChangedTrigger.cs

@ -18,7 +18,7 @@ namespace Migrations.OldTriggers
[TypeName(nameof(ContentChangedTrigger))]
public sealed record ContentChangedTrigger : RuleTrigger, IMigrated<RuleTrigger>
{
public ImmutableList<ContentChangedTriggerSchema> Schemas { get; set; }
public ReadonlyList<ContentChangedTriggerSchema> 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 };
}

2
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<string, AppClient>
public sealed class AppClients : ReadonlyDictionary<string, AppClient>
{
public static readonly AppClients Empty = new AppClients();

2
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<string, string>
public sealed class AppContributors : ReadonlyDictionary<string, string>
{
public static readonly AppContributors Empty = new AppContributors();

4
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<Pattern> Patterns { get; init; } = ImmutableList.Empty<Pattern>();
public ReadonlyList<Pattern> Patterns { get; init; } = ReadonlyList.Empty<Pattern>();
public ImmutableList<Editor> Editors { get; init; } = ImmutableList.Empty<Editor>();
public ReadonlyList<Editor> Editors { get; init; } = ReadonlyList.Empty<Editor>();
public bool HideScheduler { get; init; }

2
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));
}
}
}

6
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<Language> Fallbacks { get; } = ImmutableList.Empty<Language>();
public ReadonlyList<Language> Fallbacks { get; } = ReadonlyList.Empty<Language>();
public LanguageConfig(bool isOptional = false, ImmutableList<Language>? fallbacks = null)
public LanguageConfig(bool isOptional = false, ReadonlyList<Language>? 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);
}

2
backend/src/Squidex.Domain.Apps.Core.Model/Apps/LanguagesConfig.cs

@ -67,7 +67,7 @@ namespace Squidex.Domain.Apps.Core.Apps
var newLanguages = new Dictionary<string, LanguageConfig>(languages)
{
[language] = new LanguageConfig(isOptional, ImmutableList.Create(fallbacks))
[language] = new LanguageConfig(isOptional, ReadonlyList.Create(fallbacks))
};
return Build(newLanguages, master);

16
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<string, Role> inner;
private readonly ReadonlyDictionary<string, Role> inner;
public static readonly IReadOnlyDictionary<string, Role> Defaults = new Dictionary<string, Role>
{
@ -57,7 +57,7 @@ namespace Squidex.Domain.Apps.Core.Apps
JsonValue.Object())
};
public static readonly Roles Empty = new Roles(new ImmutableDictionary<string, Role>());
public static readonly Roles Empty = new Roles(new ReadonlyDictionary<string, Role>());
public int CustomCount
{
@ -79,14 +79,14 @@ namespace Squidex.Domain.Apps.Core.Apps
get => inner.Values.Union(Defaults.Values);
}
private Roles(ImmutableDictionary<string, Role> roles)
private Roles(ReadonlyDictionary<string, Role> roles)
{
inner = roles;
}
public Roles(Dictionary<string, Role> roles)
{
inner = new ImmutableDictionary<string, Role>(Cleaned(roles));
inner = new ReadonlyDictionary<string, Role>(Cleaned(roles));
}
[Pure]
@ -97,7 +97,7 @@ namespace Squidex.Domain.Apps.Core.Apps
return this;
}
return Create(new ImmutableDictionary<string, Role>(updated));
return Create(new ReadonlyDictionary<string, Role>(updated));
}
[Pure]
@ -115,7 +115,7 @@ namespace Squidex.Domain.Apps.Core.Apps
return this;
}
return Create(new ImmutableDictionary<string, Role>(updated));
return Create(new ReadonlyDictionary<string, Role>(updated));
}
[Pure]
@ -135,7 +135,7 @@ namespace Squidex.Domain.Apps.Core.Apps
return this;
}
return Create(new ImmutableDictionary<string, Role>(updated));
return Create(new ReadonlyDictionary<string, Role>(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<string, Role> newRoles)
private Roles Create(ReadonlyDictionary<string, Role> newRoles)
{
return ReferenceEquals(inner, newRoles) ? this : new Roles(newRoles);
}

2
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());

2
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))

16
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<Status, WorkflowStep> Steps { get; } = ImmutableDictionary.Empty<Status, WorkflowStep>();
public ReadonlyDictionary<Status, WorkflowStep> Steps { get; } = ReadonlyDictionary.Empty<Status, WorkflowStep>();
public ImmutableList<DomainId> SchemaIds { get; } = ImmutableList.Empty<DomainId>();
public ReadonlyList<DomainId> SchemaIds { get; } = ReadonlyList.Empty<DomainId>();
public string Name { get; }
public Workflow(
Status initial,
ImmutableDictionary<Status, WorkflowStep>? steps = null,
ImmutableList<DomainId>? schemaIds = null,
ReadonlyDictionary<Status, WorkflowStep>? steps = null,
ReadonlyList<DomainId>? schemaIds = null,
string? name = null)
{
Initial = initial;
@ -59,7 +59,7 @@ namespace Squidex.Domain.Apps.Core.Contents
new Dictionary<Status, WorkflowTransition>
{
[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)

2
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<string>? Roles { get; init; }
public ReadonlyList<string>? Roles { get; init; }
}
}

4
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<Status, WorkflowTransition> Transitions { get; } = ImmutableDictionary.Empty<Status, WorkflowTransition>();
public ReadonlyDictionary<Status, WorkflowTransition> Transitions { get; } = ReadonlyDictionary.Empty<Status, WorkflowTransition>();
public string? Color { get; }
public NoUpdate? NoUpdate { get; }
public WorkflowStep(ImmutableDictionary<Status, WorkflowTransition>? transitions = null, string? color = null, NoUpdate? noUpdate = null)
public WorkflowStep(ReadonlyDictionary<Status, WorkflowTransition>? transitions = null, string? color = null, NoUpdate? noUpdate = null)
{
Color = color;

2
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))

2
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<DomainId, Workflow>
public sealed class Workflows : ReadonlyDictionary<DomainId, Workflow>
{
public static readonly Workflows Empty = new Workflows();

2
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<ContentChangedTriggerSchemaV2>? Schemas { get; init; }
public ReadonlyList<ContentChangedTriggerSchemaV2>? Schemas { get; init; }
public bool HandleAll { get; init; }

2
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<string>? UniqueFields { get; init; }
public ReadonlyList<string>? UniqueFields { get; init; }
public override T Accept<T, TArgs>(IFieldPropertiesVisitor<T, TArgs> visitor, TArgs args)
{

6
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<ImmutableList<string>?> DefaultValues { get; init; }
public LocalizedValue<ReadonlyList<string>?> DefaultValues { get; init; }
public ImmutableList<string>? DefaultValue { get; init; }
public ReadonlyList<string>? DefaultValue { get; init; }
public string? FolderId { get; init; }
@ -59,7 +59,7 @@ namespace Squidex.Domain.Apps.Core.Schemas
init => ResolveFirst = value;
}
public ImmutableList<string>? AllowedExtensions { get; set; }
public ReadonlyList<string>? AllowedExtensions { get; set; }
public override T Accept<T, TArgs>(IFieldPropertiesVisitor<T, TArgs> visitor, TArgs args)
{

4
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<DomainId>? SchemaIds { get; init; }
public ReadonlyList<DomainId>? SchemaIds { get; init; }
public override T Accept<T, TArgs>(IFieldPropertiesVisitor<T, TArgs> visitor, TArgs args)
{

6
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<string>? UniqueFields { get; init; }
public ReadonlyList<string>? 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<DomainId>? SchemaIds { get; init; }
public ReadonlyList<DomainId>? SchemaIds { get; init; }
public override T Accept<T, TArgs>(IFieldPropertiesVisitor<T, TArgs> visitor, TArgs args)
{

2
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<IRootField> GetSharedFields(this ResolvedComponents components, ImmutableList<DomainId>? schemaIds, bool withHidden)
public static IEnumerable<IRootField> GetSharedFields(this ResolvedComponents components, ReadonlyList<DomainId>? schemaIds, bool withHidden)
{
if (schemaIds == null || schemaIds.Count == 0)
{

2
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<string>
public sealed class FieldNames : ReadonlyList<string>
{
public static readonly FieldNames Empty = new FieldNames(new List<string>());

2
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<string>? Tags { get; init; }
public ReadonlyList<string>? Tags { get; init; }
public abstract T Accept<T, TArgs>(IFieldPropertiesVisitor<T, TArgs> visitor, TArgs args);

2
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<FieldRule>
public sealed class FieldRules : ReadonlyList<FieldRule>
{
public static readonly FieldRules Empty = new FieldRules(new List<FieldRule>());

2
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<string, string>? PreviewUrls { get; set; }
public ReadonlyDictionary<string, string>? PreviewUrls { get; set; }
public bool IsSingleton
{

2
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<T> : ImmutableDictionary<string, T>
public sealed class LocalizedValue<T> : ReadonlyDictionary<string, T>
{
public LocalizedValue()
{

2
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<double>? AllowedValues { get; init; }
public ReadonlyList<double>? AllowedValues { get; init; }
public LocalizedValue<double?> DefaultValues { get; init; }

8
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<ImmutableList<string>?> DefaultValues { get; init; }
public LocalizedValue<ReadonlyList<string>?> DefaultValues { get; init; }
public ImmutableList<string>? DefaultValue { get; init; }
public ReadonlyList<string>? 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<DomainId>? SchemaIds { get; init; }
public ReadonlyList<DomainId>? SchemaIds { get; init; }
public override T Accept<T, TArgs>(IFieldPropertiesVisitor<T, TArgs> visitor, TArgs args)
{

2
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<DomainId, Schema>
public sealed class ResolvedComponents : ReadonlyDictionary<DomainId, Schema>
{
public static readonly ResolvedComponents Empty = new ResolvedComponents();

6
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<string, string> PreviewUrls { get; private set; } = ImmutableDictionary.Empty<string, string>();
public ReadonlyDictionary<string, string> PreviewUrls { get; private set; } = ReadonlyDictionary.Empty<string, string>();
public IReadOnlyList<RootField> Fields
{
@ -218,9 +218,9 @@ namespace Squidex.Domain.Apps.Core.Schemas
}
[Pure]
public Schema SetPreviewUrls(ImmutableDictionary<string, string>? previewUrls)
public Schema SetPreviewUrls(ReadonlyDictionary<string, string>? previewUrls)
{
previewUrls ??= ImmutableDictionary.Empty<string, string>();
previewUrls ??= ReadonlyDictionary.Empty<string, string>();
if (PreviewUrls.Equals(previewUrls))
{

2
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<string>? Tags { get; init; }
public ReadonlyList<string>? Tags { get; init; }
public string? ContentsSidebarUrl { get; init; }

2
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<string>? AllowedValues { get; init; }
public ReadonlyList<string>? AllowedValues { get; init; }
public LocalizedValue<string?> DefaultValues { get; init; }

6
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<string>? AllowedValues { get; init; }
public ReadonlyList<string>? AllowedValues { get; init; }
public LocalizedValue<ImmutableList<string>?> DefaultValues { get; init; }
public LocalizedValue<ReadonlyList<string>?> DefaultValues { get; init; }
public ImmutableList<string>? DefaultValue { get; init; }
public ReadonlyList<string>? DefaultValue { get; init; }
public int? MinItems { get; init; }

2
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<DomainId>? schemaIds, Args args)
private void BuildComponent(JsonSchema jsonSchema, ReadonlyList<DomainId>? schemaIds, Args args)
{
jsonSchema.Properties.Add(Component.Discriminator, SchemaBuilder.StringProperty(isRequired: true));

4
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<DomainId>? allowedIds)
ResolvedComponents components, ReadonlyList<DomainId>? 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<DomainId>? allowedIds)
ResolvedComponents components, ReadonlyList<DomainId>? allowedIds)
{
if (value is not JsonObject obj)
{

2
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<DomainId>? schemaIds)
async Task ResolveWithIdsAsync(IField field, ReadonlyList<DomainId>? schemaIds)
{
if (schemaIds != null)
{

2
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",

2
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<DomainId>? schemaIds)
public ComponentUnionGraphType(Builder builder, FieldInfo fieldInfo, ReadonlyList<DomainId>? schemaIds)
{
// The name is used for equal comparison. Therefore it is important to treat it as readonly.
Name = fieldInfo.ReferenceType;

4
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<DomainId>? schemaIds)
private IGraphType? ResolveReferences(FieldInfo fieldInfo, ReadonlyList<DomainId>? 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<DomainId>? schemaIds)
private IGraphType? ResolveComponent(FieldInfo fieldInfo, ReadonlyList<DomainId>? schemaIds)
{
IGraphType? componentType = null;

2
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<DomainId>? schemaIds)
public ReferenceUnionGraphType(Builder builder, FieldInfo fieldInfo, ReadonlyList<DomainId>? schemaIds)
{
// The name is used for equal comparison. Therefore it is important to treat it as readonly.
Name = fieldInfo.ReferenceType;

2
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<string, string>? PreviewUrls { get; set; }
public ReadonlyDictionary<string, string>? PreviewUrls { get; set; }
}
}

2
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<string, string>? PreviewUrls { get; set; }
public ReadonlyDictionary<string, string>? PreviewUrls { get; set; }
[IgnoreDataMember]
public override DomainId AggregateId

2
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<string, string>? PreviewUrls { get; set; }
ReadonlyDictionary<string, string>? PreviewUrls { get; set; }
Schema ToSchema(string name, SchemaType type)
{

2
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<string, string>? PreviewUrls { get; set; }
public ReadonlyDictionary<string, string>? PreviewUrls { get; set; }
public Schema BuildSchema(string name, SchemaType type)
{

2
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<string, string>? PreviewUrls { get; set; }
public ReadonlyDictionary<string, string>? PreviewUrls { get; set; }
}
}

18
backend/src/Squidex.Infrastructure/Collections/ImmutableDictionary.cs → 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<TKey, TValue> where TKey : notnull
{
#pragma warning disable SA1401 // Fields should be private
public static ImmutableDictionary<TKey, TValue> Instance = new ImmutableDictionary<TKey, TValue>();
public static ReadonlyDictionary<TKey, TValue> Instance = new ReadonlyDictionary<TKey, TValue>();
#pragma warning restore SA1401 // Fields should be private
}
public static ImmutableDictionary<TKey, TValue> Empty<TKey, TValue>() where TKey : notnull
public static ReadonlyDictionary<TKey, TValue> Empty<TKey, TValue>() where TKey : notnull
{
return Empties<TKey, TValue>.Instance;
}
public static ImmutableDictionary<TKey, TValue> ToImmutableDictionary<TKey, TValue>(this Dictionary<TKey, TValue> source) where TKey : notnull
public static ReadonlyDictionary<TKey, TValue> ToReadonlyDictionary<TKey, TValue>(this Dictionary<TKey, TValue> source) where TKey : notnull
{
if (source.Count == 0)
{
return Empty<TKey, TValue>();
}
return new ImmutableDictionary<TKey, TValue>(source);
return new ReadonlyDictionary<TKey, TValue>(source);
}
public static ImmutableDictionary<TKey, TValue> ToImmutableDictionary<TKey, TValue>(this IEnumerable<TValue> source, Func<TValue, TKey> keySelector) where TKey : notnull
public static ReadonlyDictionary<TKey, TValue> ToReadonlyDictionary<TKey, TValue>(this IEnumerable<TValue> source, Func<TValue, TKey> keySelector) where TKey : notnull
{
var inner = source.ToDictionary(keySelector);
@ -44,10 +44,10 @@ namespace Squidex.Infrastructure.Collections
return Empty<TKey, TValue>();
}
return new ImmutableDictionary<TKey, TValue>(inner);
return new ReadonlyDictionary<TKey, TValue>(inner);
}
public static ImmutableDictionary<TKey, TValue> ToImmutableDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector) where TKey : notnull
public static ReadonlyDictionary<TKey, TValue> ToReadonlyDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector) where TKey : notnull
{
var inner = source.ToDictionary(keySelector, elementSelector);
@ -56,7 +56,7 @@ namespace Squidex.Infrastructure.Collections
return Empty<TKey, TValue>();
}
return new ImmutableDictionary<TKey, TValue>(inner);
return new ReadonlyDictionary<TKey, TValue>(inner);
}
}
}

10
backend/src/Squidex.Infrastructure/Collections/ImmutableDictionary{TKey,TValue}.cs → backend/src/Squidex.Infrastructure/Collections/ReadonlyDictionary{TKey,TValue}.cs

@ -12,7 +12,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Squidex.Infrastructure.Collections
{
public class ImmutableDictionary<TKey, TValue> : IReadOnlyDictionary<TKey, TValue>, IEquatable<ImmutableDictionary<TKey, TValue>> where TKey : notnull
public class ReadonlyDictionary<TKey, TValue> : IReadOnlyDictionary<TKey, TValue>, IEquatable<ReadonlyDictionary<TKey, TValue>> where TKey : notnull
{
private static readonly Dictionary<TKey, TValue> EmptyInner = new Dictionary<TKey, TValue>();
private readonly IDictionary<TKey, TValue> inner;
@ -45,12 +45,12 @@ namespace Squidex.Infrastructure.Collections
get => inner.Count;
}
public ImmutableDictionary()
public ReadonlyDictionary()
: this(EmptyInner)
{
}
public ImmutableDictionary(IDictionary<TKey, TValue> inner)
public ReadonlyDictionary(IDictionary<TKey, TValue> 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<TKey, TValue>);
return Equals(obj as ReadonlyDictionary<TKey, TValue>);
}
public bool Equals(ImmutableDictionary<TKey, TValue>? other)
public bool Equals(ReadonlyDictionary<TKey, TValue>? other)
{
return this.EqualsDictionary(other);
}

14
backend/src/Squidex.Infrastructure/Collections/ImmutableList.cs → 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<T>
{
#pragma warning disable SA1401 // Fields should be private
public static ImmutableList<T> Instance = new ImmutableList<T>();
public static ReadonlyList<T> Instance = new ReadonlyList<T>();
#pragma warning restore SA1401 // Fields should be private
}
public static ImmutableList<T> Empty<T>()
public static ReadonlyList<T> Empty<T>()
{
return Empties<T>.Instance;
}
public static ImmutableList<T> Create<T>(params T[]? items)
public static ReadonlyList<T> Create<T>(params T[]? items)
{
if (items == null || items.Length == 0)
{
return Empty<T>();
}
return new ImmutableList<T>(items.ToList());
return new ReadonlyList<T>(items.ToList());
}
public static ImmutableList<T> ToImmutableList<T>(this IEnumerable<T> source)
public static ReadonlyList<T> ToReadonlyList<T>(this IEnumerable<T> source)
{
var inner = source.ToList();
@ -43,7 +43,7 @@ namespace Squidex.Infrastructure.Collections
return Empty<T>();
}
return new ImmutableList<T>(inner);
return new ReadonlyList<T>(inner);
}
}
}

10
backend/src/Squidex.Infrastructure/Collections/ImmutableList{T}.cs → backend/src/Squidex.Infrastructure/Collections/ReadonlyList{T}.cs

@ -11,26 +11,26 @@ using System.Collections.ObjectModel;
namespace Squidex.Infrastructure.Collections
{
public class ImmutableList<T> : ReadOnlyCollection<T>, IEquatable<ImmutableList<T>>
public class ReadonlyList<T> : ReadOnlyCollection<T>, IEquatable<ReadonlyList<T>>
{
private static readonly List<T> EmptyInner = new List<T>();
public ImmutableList()
public ReadonlyList()
: base(EmptyInner)
{
}
public ImmutableList(IList<T> list)
public ReadonlyList(IList<T> list)
: base(list)
{
}
public override bool Equals(object? obj)
{
return Equals(obj as ImmutableList<T>);
return Equals(obj as ReadonlyList<T>);
}
public virtual bool Equals(ImmutableList<T>? other)
public virtual bool Equals(ReadonlyList<T>? other)
{
return this.EqualsList(other);
}

2
backend/src/Squidex.Infrastructure/Queries/PropertyPath.cs

@ -12,7 +12,7 @@ using Squidex.Infrastructure.Collections;
namespace Squidex.Infrastructure.Queries
{
public sealed class PropertyPath : ImmutableList<string>
public sealed class PropertyPath : ReadonlyList<string>
{
private static readonly char[] Separators = { '.', '/' };

2
backend/src/Squidex.Infrastructure/Security/PermissionSet.cs

@ -12,7 +12,7 @@ using Squidex.Infrastructure.Collections;
namespace Squidex.Infrastructure.Security
{
public sealed class PermissionSet : ImmutableList<Permission>
public sealed class PermissionSet : ReadonlyList<Permission>
{
public static readonly PermissionSet Empty = new PermissionSet(Array.Empty<string>());

4
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;
}

4
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()!
}
};
}

4
backend/src/Squidex/Areas/Api/Controllers/Apps/Models/UpdateWorkflowDto.cs

@ -30,7 +30,7 @@ namespace Squidex.Areas.Api.Controllers.Apps.Models
/// <summary>
/// The schema ids.
/// </summary>
public ImmutableList<DomainId>? SchemaIds { get; set; }
public ReadonlyList<DomainId>? SchemaIds { get; set; }
/// <summary>
/// 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,

2
backend/src/Squidex/Areas/Api/Controllers/Apps/Models/WorkflowDto.cs

@ -37,7 +37,7 @@ namespace Squidex.Areas.Api.Controllers.Apps.Models
/// <summary>
/// The schema ids.
/// </summary>
public ImmutableList<DomainId>? SchemaIds { get; set; }
public ReadonlyList<DomainId>? SchemaIds { get; set; }
/// <summary>
/// The initial step.

2
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,

2
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<IReadOnlyList<IAssetFolderEntity>>(ImmutableList.Empty<IAssetFolderEntity>());
return Task.FromResult<IReadOnlyList<IAssetFolderEntity>>(ReadonlyList.Empty<IAssetFolderEntity>());
}
return assetQuery.FindAssetFolderAsync(Context.App.Id, parentId, HttpContext.RequestAborted);

2
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 };
}

2
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<string, string>(this).ToImmutableDictionary()
PreviewUrls = new Dictionary<string, string>(this).ToReadonlyDictionary()
};
}
}

2
backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/FieldPropertiesDto.cs

@ -61,7 +61,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models
/// <summary>
/// Tags for automation processes.
/// </summary>
public ImmutableList<string>? Tags { get; set; }
public ReadonlyList<string>? Tags { get; set; }
public abstract FieldProperties ToProperties();

2
backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/ArrayFieldPropertiesDto.cs

@ -26,7 +26,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models.Fields
/// <summary>
/// The fields that must be unique.
/// </summary>
public ImmutableList<string>? UniqueFields { get; set; }
public ReadonlyList<string>? UniqueFields { get; set; }
public override FieldProperties ToProperties()
{

6
backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/AssetsFieldPropertiesDto.cs

@ -23,12 +23,12 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models.Fields
/// <summary>
/// The language specific default value as a list of asset ids.
/// </summary>
public LocalizedValue<ImmutableList<string>?> DefaultValues { get; set; }
public LocalizedValue<ReadonlyList<string>?> DefaultValues { get; set; }
/// <summary>
/// The default value as a list of asset ids.
/// </summary>
public ImmutableList<string>? DefaultValue { get; set; }
public ReadonlyList<string>? DefaultValue { get; set; }
/// <summary>
/// The initial id to the folder.
@ -118,7 +118,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models.Fields
/// <summary>
/// The allowed file extensions.
/// </summary>
public ImmutableList<string>? AllowedExtensions { get; set; }
public ReadonlyList<string>? AllowedExtensions { get; set; }
/// <summary>
/// True, if duplicate values are allowed.

2
backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/ComponentFieldPropertiesDto.cs

@ -17,7 +17,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models.Fields
/// <summary>
/// The id of the embedded schemas.
/// </summary>
public ImmutableList<DomainId>? SchemaIds { get; set; }
public ReadonlyList<DomainId>? SchemaIds { get; set; }
public override FieldProperties ToProperties()
{

4
backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/ComponentsFieldPropertiesDto.cs

@ -27,12 +27,12 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models.Fields
/// <summary>
/// The id of the embedded schemas.
/// </summary>
public ImmutableList<DomainId>? SchemaIds { get; set; }
public ReadonlyList<DomainId>? SchemaIds { get; set; }
/// <summary>
/// The fields that must be unique.
/// </summary>
public ImmutableList<string>? UniqueFields { get; set; }
public ReadonlyList<string>? UniqueFields { get; set; }
public override FieldProperties ToProperties()
{

2
backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/NumberFieldPropertiesDto.cs

@ -36,7 +36,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models.Fields
/// <summary>
/// The allowed values for the field value.
/// </summary>
public ImmutableList<double>? AllowedValues { get; set; }
public ReadonlyList<double>? AllowedValues { get; set; }
/// <summary>
/// Indicates if the field value must be unique. Ignored for nested fields and localized fields.

6
backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/ReferencesFieldPropertiesDto.cs

@ -17,12 +17,12 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models.Fields
/// <summary>
/// The language specific default value as a list of content ids.
/// </summary>
public LocalizedValue<ImmutableList<string>?> DefaultValues { get; set; }
public LocalizedValue<ReadonlyList<string>?> DefaultValues { get; set; }
/// <summary>
/// The default value as a list of content ids.
/// </summary>
public ImmutableList<string>? DefaultValue { get; set; }
public ReadonlyList<string>? DefaultValue { get; set; }
/// <summary>
/// The minimum allowed items for the field value.
@ -57,7 +57,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models.Fields
/// <summary>
/// The id of the referenced schemas.
/// </summary>
public ImmutableList<DomainId>? SchemaIds { get; set; }
public ReadonlyList<DomainId>? SchemaIds { get; set; }
public override FieldProperties ToProperties()
{

2
backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/StringFieldPropertiesDto.cs

@ -71,7 +71,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models.Fields
/// <summary>
/// The allowed values for the field value.
/// </summary>
public ImmutableList<string>? AllowedValues { get; set; }
public ReadonlyList<string>? AllowedValues { get; set; }
/// <summary>
/// Indicates if the field value must be unique. Ignored for nested fields and localized fields.

6
backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/TagsFieldPropertiesDto.cs

@ -16,12 +16,12 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models.Fields
/// <summary>
/// The language specific default value for the field value.
/// </summary>
public LocalizedValue<ImmutableList<string>?> DefaultValues { get; set; }
public LocalizedValue<ReadonlyList<string>?> DefaultValues { get; set; }
/// <summary>
/// The default value.
/// </summary>
public ImmutableList<string>? DefaultValue { get; set; }
public ReadonlyList<string>? DefaultValue { get; set; }
/// <summary>
/// The minimum allowed items for the field value.
@ -36,7 +36,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models.Fields
/// <summary>
/// The allowed values for the field value.
/// </summary>
public ImmutableList<string>? AllowedValues { get; set; }
public ReadonlyList<string>? AllowedValues { get; set; }
/// <summary>
/// The editor that is used to manage this field.

2
backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/SchemaDto.cs

@ -101,7 +101,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models
/// The preview Urls.
/// </summary>
[LocalizedRequired]
public ImmutableDictionary<string, string> PreviewUrls { get; set; }
public ReadonlyDictionary<string, string> PreviewUrls { get; set; }
/// <summary>
/// The name of fields that are used in content lists.

2
backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/SchemaPropertiesDto.cs

@ -47,6 +47,6 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models
/// <summary>
/// Tags for automation processes.
/// </summary>
public ImmutableList<string>? Tags { get; set; }
public ReadonlyList<string>? Tags { get; set; }
}
}

2
backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/UpdateSchemaDto.cs

@ -50,7 +50,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models
/// <summary>
/// Tags for automation processes.
/// </summary>
public ImmutableList<string>? Tags { get; set; }
public ReadonlyList<string>? Tags { get; set; }
public UpdateSchema ToCommand()
{

2
backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/UpsertSchemaDto.cs

@ -43,7 +43,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models
/// <summary>
/// The optional preview urls.
/// </summary>
public ImmutableDictionary<string, string>? PreviewUrls { get; set; }
public ReadonlyDictionary<string, string>? PreviewUrls { get; set; }
/// <summary>
/// The optional field Rules.

2
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)
}
};
});

6
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<string, LanguageConfig>
{
[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<string, LanguageConfig>
{
[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);

6
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, WorkflowTransition>
{
[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();

4
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()

8
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<ImmutableList<string>?>(new Dictionary<string, ImmutableList<string>?>
DefaultValues = new LocalizedValue<ReadonlyList<string>?>(new Dictionary<string, ReadonlyList<string>?>
{
["iv"] = ImmutableList.Create("A", "B", "C")
["iv"] = ReadonlyList.Create("A", "B", "C")
})
};
var rhs = new TagsFieldProperties
{
DefaultValues = new LocalizedValue<ImmutableList<string>?>(new Dictionary<string, ImmutableList<string>?>
DefaultValues = new LocalizedValue<ReadonlyList<string>?>(new Dictionary<string, ReadonlyList<string>?>
{
["iv"] = ImmutableList.Create("A", "B", "C")
["iv"] = ReadonlyList.Create("A", "B", "C")
})
};

6
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<string, string>
{
["web"] = "Url"
}.ToImmutableDictionary();
}.ToReadonlyDictionary();
var urls2 = new Dictionary<string, string>
{
["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<string, string>
{
["web"] = "Url"
}.ToImmutableDictionary());
}.ToReadonlyDictionary());
var schemaTarget = schemaSource.SerializeAndDeserialize();

18
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<ImmutableList<string>?>(new Dictionary<string, ImmutableList<string>?>
DefaultValues = new LocalizedValue<ReadonlyList<string>?>(new Dictionary<string, ReadonlyList<string>?>
{
[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<ImmutableList<string>?>(new Dictionary<string, ImmutableList<string>?>
DefaultValues = new LocalizedValue<ReadonlyList<string>?>(new Dictionary<string, ReadonlyList<string>?>
{
[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<ImmutableList<string>?>(new Dictionary<string, ImmutableList<string>?>
DefaultValues = new LocalizedValue<ReadonlyList<string>?>(new Dictionary<string, ReadonlyList<string>?>
{
[language.Iso2Code] = null
}),
DefaultValue = ImmutableList.Create("tag1", "tag2")
DefaultValue = ReadonlyList.Create("tag1", "tag2")
});
Assert.Equal(JsonValue.Array(), DefaultValueFactory.CreateDefaultValue(field, now, language.Iso2Code));

2
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<string, string>
{
["web"] = "Url"
}.ToImmutableDictionary();
}.ToReadonlyDictionary();
var sourceSchema =
new Schema("source");

4
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);

2
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);

4
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);

2
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);

2
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);

2
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);

2
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);

2
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,

12
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"))
}
};

16
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, WorkflowStep>
{
[Status.Published] = new WorkflowStep()
}.ToImmutableDictionary()),
}.ToReadonlyDictionary()),
WorkflowId = workflowId
};
@ -94,7 +94,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.DomainObject.Guards
new Dictionary<Status, WorkflowStep>
{
[Status.Published] = new WorkflowStep()
}.ToImmutableDictionary()),
}.ToReadonlyDictionary()),
WorkflowId = workflowId
};
@ -112,7 +112,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.DomainObject.Guards
new Dictionary<Status, WorkflowStep>
{
[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, WorkflowTransition>
{
[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, WorkflowTransition>
{
[Status.Draft] = null!
}.ToImmutableDictionary())
}.ToImmutableDictionary()),
}.ToReadonlyDictionary())
}.ToReadonlyDictionary()),
WorkflowId = workflowId
};

4
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

10
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);

16
backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DynamicContentWorkflowTests.cs

@ -40,7 +40,7 @@ namespace Squidex.Domain.Apps.Entities.Contents
new Dictionary<Status, WorkflowTransition>
{
[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, WorkflowTransition>
{
[Status.Published] = WorkflowTransition.Always
}.ToImmutableDictionary(),
}.ToReadonlyDictionary(),
StatusColors.Draft),
[Status.Published] =
new WorkflowStep(
new Dictionary<Status, WorkflowTransition>
{
[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);

2
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

6
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<ContentChangedTriggerSchemaV2>()
Schemas = ReadonlyList.Empty<ContentChangedTriggerSchemaV2>()
},
Action = null!,
});
@ -77,7 +77,7 @@ namespace Squidex.Domain.Apps.Entities.Rules.DomainObject.Guards
{
Trigger = new ContentChangedTriggerV2
{
Schemas = ImmutableList.Empty<ContentChangedTriggerSchemaV2>()
Schemas = ReadonlyList.Empty<ContentChangedTriggerSchemaV2>()
},
Action = new TestAction
{
@ -111,7 +111,7 @@ namespace Squidex.Domain.Apps.Entities.Rules.DomainObject.Guards
{
Trigger = new ContentChangedTriggerV2
{
Schemas = ImmutableList.Empty<ContentChangedTriggerSchemaV2>()
Schemas = ReadonlyList.Empty<ContentChangedTriggerSchemaV2>()
},
Action = new TestAction
{

8
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<ContentChangedTriggerSchemaV2>()
Schemas = ReadonlyList.Empty<ContentChangedTriggerSchemaV2>()
};
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);

4
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();

4
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();

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save