From 5ca5f153bf80fd62729b429d82263d46a49739f1 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sat, 26 Feb 2022 18:49:08 +0100 Subject: [PATCH] Minor fixes. --- .../Squidex.CLI.Tests/FolderTreeTests.cs | 1 + .../Squidex.CLI.Tests/Squidex.CLI.Tests.csproj | 6 +++--- .../Commands/Implementation/Sync/FolderNode.cs | 1 - .../Sync/Schemas/SchemasSynchronizer.cs | 13 +++---------- .../Implementation/Utils/PropertyAccessor.cs | 2 +- .../Implementation/Utils/SimpleMapper.cs | 16 ++++++++-------- cli/Squidex.CLI/Squidex.CLI/Squidex.CLI.csproj | 9 +++++---- 7 files changed, 21 insertions(+), 27 deletions(-) diff --git a/cli/Squidex.CLI/Squidex.CLI.Tests/FolderTreeTests.cs b/cli/Squidex.CLI/Squidex.CLI.Tests/FolderTreeTests.cs index 82483f95..d92480b5 100644 --- a/cli/Squidex.CLI/Squidex.CLI.Tests/FolderTreeTests.cs +++ b/cli/Squidex.CLI/Squidex.CLI.Tests/FolderTreeTests.cs @@ -7,6 +7,7 @@ using FakeItEasy; using Squidex.CLI.Commands.Implementation; +using Squidex.CLI.Commands.Implementation.Sync; using Squidex.ClientLibrary.Management; using Xunit; diff --git a/cli/Squidex.CLI/Squidex.CLI.Tests/Squidex.CLI.Tests.csproj b/cli/Squidex.CLI/Squidex.CLI.Tests/Squidex.CLI.Tests.csproj index ad0f416e..a586c615 100644 --- a/cli/Squidex.CLI/Squidex.CLI.Tests/Squidex.CLI.Tests.csproj +++ b/cli/Squidex.CLI/Squidex.CLI.Tests/Squidex.CLI.Tests.csproj @@ -5,12 +5,12 @@ enable - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/cli/Squidex.CLI/Squidex.CLI/Commands/Implementation/Sync/FolderNode.cs b/cli/Squidex.CLI/Squidex.CLI/Commands/Implementation/Sync/FolderNode.cs index d5203f04..9e0b2a44 100644 --- a/cli/Squidex.CLI/Squidex.CLI/Commands/Implementation/Sync/FolderNode.cs +++ b/cli/Squidex.CLI/Squidex.CLI/Commands/Implementation/Sync/FolderNode.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== - #pragma warning disable SA1313 // Parameter names should begin with lower-case letter namespace Squidex.CLI.Commands.Implementation.Sync diff --git a/cli/Squidex.CLI/Squidex.CLI/Commands/Implementation/Sync/Schemas/SchemasSynchronizer.cs b/cli/Squidex.CLI/Squidex.CLI/Commands/Implementation/Sync/Schemas/SchemasSynchronizer.cs index c3a9c9cb..d76935a1 100644 --- a/cli/Squidex.CLI/Squidex.CLI/Commands/Implementation/Sync/Schemas/SchemasSynchronizer.cs +++ b/cli/Squidex.CLI/Squidex.CLI/Commands/Implementation/Sync/Schemas/SchemasSynchronizer.cs @@ -122,17 +122,10 @@ await log.DoSafeAsync($"Schema {model.Name} creating", async () => await model.Schema.MapReferencesAsync(schemaMap); await model.Schema.MapFoldersAsync(sync.Folders, false); - var version = schemasByName[model.Name].Version; - - if (!options.Delete) - { - model.Schema.NoFieldRecreation = true; - } + model.Schema.NoFieldDeletion |= !options.Delete; + model.Schema.NoFieldRecreation |= !options.Recreate; - if (!options.Recreate) - { - model.Schema.NoFieldRecreation = true; - } + var version = schemasByName[model.Name].Version; await log.DoVersionedAsync($"Schema {model.Name} updating", version, async () => { diff --git a/cli/Squidex.CLI/Squidex.CLI/Commands/Implementation/Utils/PropertyAccessor.cs b/cli/Squidex.CLI/Squidex.CLI/Commands/Implementation/Utils/PropertyAccessor.cs index 80c37929..b39eba2e 100644 --- a/cli/Squidex.CLI/Squidex.CLI/Commands/Implementation/Utils/PropertyAccessor.cs +++ b/cli/Squidex.CLI/Squidex.CLI/Commands/Implementation/Utils/PropertyAccessor.cs @@ -57,7 +57,7 @@ public void Set(object source, object? value) private readonly IPropertyAccessor internalAccessor; - public PropertyAccessor(Type targetType, PropertyInfo propertyInfo) + public PropertyAccessor(PropertyInfo propertyInfo) { var type = typeof(PropertyWrapper<,>).MakeGenericType(propertyInfo.DeclaringType!, propertyInfo.PropertyType); diff --git a/cli/Squidex.CLI/Squidex.CLI/Commands/Implementation/Utils/SimpleMapper.cs b/cli/Squidex.CLI/Squidex.CLI/Commands/Implementation/Utils/SimpleMapper.cs index efc4b5d1..ef8a866d 100644 --- a/cli/Squidex.CLI/Squidex.CLI/Commands/Implementation/Utils/SimpleMapper.cs +++ b/cli/Squidex.CLI/Squidex.CLI/Commands/Implementation/Utils/SimpleMapper.cs @@ -161,14 +161,14 @@ static ClassMapper() if (sourceType == targetType) { Mappers.Add(new PropertyMapper( - new PropertyAccessor(sourceClassType, sourceProperty), - new PropertyAccessor(targetClassType, targetProperty))); + new PropertyAccessor(sourceProperty), + new PropertyAccessor(targetProperty))); } else if (targetType == typeof(string)) { Mappers.Add(new StringConversionPropertyMapper( - new PropertyAccessor(sourceClassType, sourceProperty), - new PropertyAccessor(targetClassType, targetProperty))); + new PropertyAccessor(sourceProperty), + new PropertyAccessor(targetProperty))); } else { @@ -177,15 +177,15 @@ static ClassMapper() if (converter.CanConvertFrom(sourceType)) { Mappers.Add(new TypeConverterPropertyMapper( - new PropertyAccessor(sourceClassType, sourceProperty), - new PropertyAccessor(targetClassType, targetProperty), + new PropertyAccessor(sourceProperty), + new PropertyAccessor(targetProperty), converter)); } else if (sourceType.Implements() || targetType.Implements()) { Mappers.Add(new ConversionPropertyMapper( - new PropertyAccessor(sourceClassType, sourceProperty), - new PropertyAccessor(targetClassType, targetProperty), + new PropertyAccessor(sourceProperty), + new PropertyAccessor(targetProperty), targetType)); } } diff --git a/cli/Squidex.CLI/Squidex.CLI/Squidex.CLI.csproj b/cli/Squidex.CLI/Squidex.CLI/Squidex.CLI.csproj index c4d5b27c..4bafa24f 100644 --- a/cli/Squidex.CLI/Squidex.CLI/Squidex.CLI.csproj +++ b/cli/Squidex.CLI/Squidex.CLI/Squidex.CLI.csproj @@ -6,6 +6,7 @@ MIT Command Line Interface for Squidex Headless CMS enable + latest enable Exe logo-squared.png @@ -16,24 +17,24 @@ net6.0 true sq - 8.1 + 8.2 - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive - +