From d90534769ce4a3059439bf5ec5799df1eb9774c8 Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Mon, 9 Dec 2019 08:40:49 +0100 Subject: [PATCH] Moved Serialization from Umbraco.Core to Umbraco.Infrastructure and added reference to Newtonsoft.Json --- src/Umbraco.Core/Umbraco.Core.csproj | 34 +++++++------------ .../CaseInsensitiveDictionaryConverter.cs | 0 .../Serialization/ForceInt32Converter.cs | 2 +- .../Serialization/FuzzyBooleanConverter.cs | 0 .../Serialization/JsonNetSerializer.cs | 0 .../Serialization/JsonReadConverter.cs | 2 +- .../Serialization/JsonToStringConverter.cs | 0 .../KnownTypeUdiJsonConverter.cs | 0 .../NoTypeConverterJsonConverter.cs | 2 +- .../Serialization/UdiJsonConverter.cs | 0 .../Serialization/UdiRangeJsonConverter.cs | 0 .../Umbraco.Infrastructure.csproj | 17 ++++++++++ src/Umbraco.Tests/Umbraco.Tests.csproj | 4 +++ .../Runtime/WebInitialComponent.cs | 2 +- src/Umbraco.Web/Umbraco.Web.csproj | 4 +++ 15 files changed, 41 insertions(+), 26 deletions(-) rename src/{Umbraco.Core => Umbraco.Infrastructure}/Serialization/CaseInsensitiveDictionaryConverter.cs (100%) rename src/{Umbraco.Core => Umbraco.Infrastructure}/Serialization/ForceInt32Converter.cs (93%) rename src/{Umbraco.Core => Umbraco.Infrastructure}/Serialization/FuzzyBooleanConverter.cs (100%) rename src/{Umbraco.Core => Umbraco.Infrastructure}/Serialization/JsonNetSerializer.cs (100%) rename src/{Umbraco.Core => Umbraco.Infrastructure}/Serialization/JsonReadConverter.cs (96%) rename src/{Umbraco.Core => Umbraco.Infrastructure}/Serialization/JsonToStringConverter.cs (100%) rename src/{Umbraco.Core => Umbraco.Infrastructure}/Serialization/KnownTypeUdiJsonConverter.cs (100%) rename src/{Umbraco.Core => Umbraco.Infrastructure}/Serialization/NoTypeConverterJsonConverter.cs (97%) rename src/{Umbraco.Core => Umbraco.Infrastructure}/Serialization/UdiJsonConverter.cs (100%) rename src/{Umbraco.Core => Umbraco.Infrastructure}/Serialization/UdiRangeJsonConverter.cs (100%) diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 5bbd3942a4..bd7c9a03b3 100755 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -206,6 +206,18 @@ + + + + + + + + + + + + @@ -217,16 +229,9 @@ - - - - - - - @@ -310,10 +315,6 @@ - - - - @@ -697,8 +698,6 @@ - - @@ -722,15 +721,6 @@ - - - - - - - - - diff --git a/src/Umbraco.Core/Serialization/CaseInsensitiveDictionaryConverter.cs b/src/Umbraco.Infrastructure/Serialization/CaseInsensitiveDictionaryConverter.cs similarity index 100% rename from src/Umbraco.Core/Serialization/CaseInsensitiveDictionaryConverter.cs rename to src/Umbraco.Infrastructure/Serialization/CaseInsensitiveDictionaryConverter.cs diff --git a/src/Umbraco.Core/Serialization/ForceInt32Converter.cs b/src/Umbraco.Infrastructure/Serialization/ForceInt32Converter.cs similarity index 93% rename from src/Umbraco.Core/Serialization/ForceInt32Converter.cs rename to src/Umbraco.Infrastructure/Serialization/ForceInt32Converter.cs index 9cff7f1401..ace7f82ab2 100644 --- a/src/Umbraco.Core/Serialization/ForceInt32Converter.cs +++ b/src/Umbraco.Infrastructure/Serialization/ForceInt32Converter.cs @@ -4,7 +4,7 @@ using Newtonsoft.Json.Linq; namespace Umbraco.Core.Serialization { - internal class ForceInt32Converter : JsonConverter + public class ForceInt32Converter : JsonConverter { public override bool CanConvert(Type objectType) { diff --git a/src/Umbraco.Core/Serialization/FuzzyBooleanConverter.cs b/src/Umbraco.Infrastructure/Serialization/FuzzyBooleanConverter.cs similarity index 100% rename from src/Umbraco.Core/Serialization/FuzzyBooleanConverter.cs rename to src/Umbraco.Infrastructure/Serialization/FuzzyBooleanConverter.cs diff --git a/src/Umbraco.Core/Serialization/JsonNetSerializer.cs b/src/Umbraco.Infrastructure/Serialization/JsonNetSerializer.cs similarity index 100% rename from src/Umbraco.Core/Serialization/JsonNetSerializer.cs rename to src/Umbraco.Infrastructure/Serialization/JsonNetSerializer.cs diff --git a/src/Umbraco.Core/Serialization/JsonReadConverter.cs b/src/Umbraco.Infrastructure/Serialization/JsonReadConverter.cs similarity index 96% rename from src/Umbraco.Core/Serialization/JsonReadConverter.cs rename to src/Umbraco.Infrastructure/Serialization/JsonReadConverter.cs index c13f4a562b..9404d7fe36 100644 --- a/src/Umbraco.Core/Serialization/JsonReadConverter.cs +++ b/src/Umbraco.Infrastructure/Serialization/JsonReadConverter.cs @@ -9,7 +9,7 @@ namespace Umbraco.Core.Serialization /// Provides a base class for custom implementations. /// /// The type of the converted object. - internal abstract class JsonReadConverter : JsonConverter + public abstract class JsonReadConverter : JsonConverter { /// /// Create an instance of objectType, based properties in the JSON object diff --git a/src/Umbraco.Core/Serialization/JsonToStringConverter.cs b/src/Umbraco.Infrastructure/Serialization/JsonToStringConverter.cs similarity index 100% rename from src/Umbraco.Core/Serialization/JsonToStringConverter.cs rename to src/Umbraco.Infrastructure/Serialization/JsonToStringConverter.cs diff --git a/src/Umbraco.Core/Serialization/KnownTypeUdiJsonConverter.cs b/src/Umbraco.Infrastructure/Serialization/KnownTypeUdiJsonConverter.cs similarity index 100% rename from src/Umbraco.Core/Serialization/KnownTypeUdiJsonConverter.cs rename to src/Umbraco.Infrastructure/Serialization/KnownTypeUdiJsonConverter.cs diff --git a/src/Umbraco.Core/Serialization/NoTypeConverterJsonConverter.cs b/src/Umbraco.Infrastructure/Serialization/NoTypeConverterJsonConverter.cs similarity index 97% rename from src/Umbraco.Core/Serialization/NoTypeConverterJsonConverter.cs rename to src/Umbraco.Infrastructure/Serialization/NoTypeConverterJsonConverter.cs index b06ee870de..4402cb4043 100644 --- a/src/Umbraco.Core/Serialization/NoTypeConverterJsonConverter.cs +++ b/src/Umbraco.Infrastructure/Serialization/NoTypeConverterJsonConverter.cs @@ -16,7 +16,7 @@ namespace Umbraco.Core.Serialization /// don't require this because to convert to string, we just override ToString(). /// I'll leave this class here for the future though. /// - internal class NoTypeConverterJsonConverter : JsonConverter + public class NoTypeConverterJsonConverter : JsonConverter { static readonly IContractResolver resolver = new NoTypeConverterContractResolver(); diff --git a/src/Umbraco.Core/Serialization/UdiJsonConverter.cs b/src/Umbraco.Infrastructure/Serialization/UdiJsonConverter.cs similarity index 100% rename from src/Umbraco.Core/Serialization/UdiJsonConverter.cs rename to src/Umbraco.Infrastructure/Serialization/UdiJsonConverter.cs diff --git a/src/Umbraco.Core/Serialization/UdiRangeJsonConverter.cs b/src/Umbraco.Infrastructure/Serialization/UdiRangeJsonConverter.cs similarity index 100% rename from src/Umbraco.Core/Serialization/UdiRangeJsonConverter.cs rename to src/Umbraco.Infrastructure/Serialization/UdiRangeJsonConverter.cs diff --git a/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj b/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj index 5c07f6d385..478fe4868f 100644 --- a/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj +++ b/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj @@ -8,6 +8,7 @@ + @@ -24,4 +25,20 @@ <_UnmanagedRegistrationCache Remove="obj\Umbraco.Infrastructure.csproj.UnmanagedRegistration.cache" /> + + + + + + + + + + + + + + + + diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj index 602a2f928e..d2ed9ce8d6 100644 --- a/src/Umbraco.Tests/Umbraco.Tests.csproj +++ b/src/Umbraco.Tests/Umbraco.Tests.csproj @@ -561,6 +561,10 @@ {31785BC3-256C-4613-B2F5-A1B0BDDED8C1} Umbraco.Core + + {3ae7bf57-966b-45a5-910a-954d7c554441} + Umbraco.Infrastructure + {52ac0ba8-a60e-4e36-897b-e8b97a54ed1c} Umbraco.ModelsBuilder.Embedded diff --git a/src/Umbraco.Web/Runtime/WebInitialComponent.cs b/src/Umbraco.Web/Runtime/WebInitialComponent.cs index e5063716a2..1edd289038 100644 --- a/src/Umbraco.Web/Runtime/WebInitialComponent.cs +++ b/src/Umbraco.Web/Runtime/WebInitialComponent.cs @@ -53,7 +53,7 @@ namespace Umbraco.Web.Runtime // When using a non-web runtime and this component is loaded ClientDependency explodes because it'll // want to access HttpContext.Current, which doesn't exist - if (Current.HostingEnvironment.IsHosted) + if (_hostingEnvironment.IsHosted) { ConfigureClientDependency(); } diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index a669ed82f8..f9620df958 100755 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -115,6 +115,10 @@ Umbraco.Examine {07FBC26B-2927-4A22-8D96-D644C667FECC} + + {3ae7bf57-966b-45a5-910a-954d7c554441} + Umbraco.Infrastructure +