From 03ffe81d831977337565e44511303ff4785cd014 Mon Sep 17 00:00:00 2001 From: maliming Date: Thu, 21 Jul 2022 16:09:09 +0800 Subject: [PATCH] Split JSON into `Newtonsoft` & `SystemTextJson` packages. Resolve #12124 --- framework/Volo.Abp.sln | 21 +++++++++++++ .../src/Volo.Abp.Json.Core/FodyWeavers.xml | 3 ++ .../src/Volo.Abp.Json.Core/FodyWeavers.xsd | 30 +++++++++++++++++++ .../Volo.Abp.Json.Core.csproj | 20 +++++++++++++ .../Volo/Abp/Json/AbpHybridJsonSerializer.cs | 0 .../Volo/Abp/Json/AbpJsonCoreModule.cs | 8 +++++ .../Volo/Abp/Json/AbpJsonOptions.cs | 2 -- .../Volo/Abp/Json/IJsonSerializer.cs | 0 .../Volo/Abp/Json/IJsonSerializerProvider.cs | 0 .../Volo.Abp.Json.Newtonsoft/FodyWeavers.xml | 3 ++ .../Volo.Abp.Json.Newtonsoft/FodyWeavers.xsd | 30 +++++++++++++++++++ .../Volo.Abp.Json.Newtonsoft.csproj | 23 ++++++++++++++ .../Newtonsoft/AbpJsonIsoDateTimeConverter.cs | 0 .../Newtonsoft/AbpJsonNewtonsoftModule.cs | 21 +++++++++++++ .../AbpNewtonsoftJsonSerializerOptions.cs | 0 .../AbpNewtonsoftJsonSerializerProvider.cs | 0 .../FodyWeavers.xml | 3 ++ .../FodyWeavers.xsd | 30 +++++++++++++++++++ .../Volo.Abp.Json.SystemTextJson.csproj | 22 ++++++++++++++ .../AbpJsonSystemTextJsonModule.cs | 26 ++++++++++++++++ .../AbpSystemTextJsonSerializerOptions.cs | 0 ...AbpSystemTextJsonSerializerOptionsSetup.cs | 0 .../AbpSystemTextJsonSerializerProvider.cs | 0 ...AbpSystemTextJsonUnsupportedTypeMatcher.cs | 0 .../JsonConverters/AbpDateTimeConverter.cs | 4 +-- .../AbpNullableDateTimeConverter.cs | 0 .../AbpStringToBooleanConverter.cs | 0 .../AbpStringToEnumConverter.cs | 0 .../JsonConverters/AbpStringToEnumFactory.cs | 0 .../ObjectToInferredTypesConverter.cs | 0 .../src/Volo.Abp.Json/Volo.Abp.Json.csproj | 5 ++-- .../Volo/Abp/Json/AbpJsonModule.cs | 27 ++--------------- 32 files changed, 246 insertions(+), 32 deletions(-) create mode 100644 framework/src/Volo.Abp.Json.Core/FodyWeavers.xml create mode 100644 framework/src/Volo.Abp.Json.Core/FodyWeavers.xsd create mode 100644 framework/src/Volo.Abp.Json.Core/Volo.Abp.Json.Core.csproj rename framework/src/{Volo.Abp.Json => Volo.Abp.Json.Core}/Volo/Abp/Json/AbpHybridJsonSerializer.cs (100%) create mode 100644 framework/src/Volo.Abp.Json.Core/Volo/Abp/Json/AbpJsonCoreModule.cs rename framework/src/{Volo.Abp.Json => Volo.Abp.Json.Core}/Volo/Abp/Json/AbpJsonOptions.cs (87%) rename framework/src/{Volo.Abp.Json => Volo.Abp.Json.Core}/Volo/Abp/Json/IJsonSerializer.cs (100%) rename framework/src/{Volo.Abp.Json => Volo.Abp.Json.Core}/Volo/Abp/Json/IJsonSerializerProvider.cs (100%) create mode 100644 framework/src/Volo.Abp.Json.Newtonsoft/FodyWeavers.xml create mode 100644 framework/src/Volo.Abp.Json.Newtonsoft/FodyWeavers.xsd create mode 100644 framework/src/Volo.Abp.Json.Newtonsoft/Volo.Abp.Json.Newtonsoft.csproj rename framework/src/{Volo.Abp.Json => Volo.Abp.Json.Newtonsoft}/Volo/Abp/Json/Newtonsoft/AbpJsonIsoDateTimeConverter.cs (100%) create mode 100644 framework/src/Volo.Abp.Json.Newtonsoft/Volo/Abp/Json/Newtonsoft/AbpJsonNewtonsoftModule.cs rename framework/src/{Volo.Abp.Json => Volo.Abp.Json.Newtonsoft}/Volo/Abp/Json/Newtonsoft/AbpNewtonsoftJsonSerializerOptions.cs (100%) rename framework/src/{Volo.Abp.Json => Volo.Abp.Json.Newtonsoft}/Volo/Abp/Json/Newtonsoft/AbpNewtonsoftJsonSerializerProvider.cs (100%) create mode 100644 framework/src/Volo.Abp.Json.SystemTextJson/FodyWeavers.xml create mode 100644 framework/src/Volo.Abp.Json.SystemTextJson/FodyWeavers.xsd create mode 100644 framework/src/Volo.Abp.Json.SystemTextJson/Volo.Abp.Json.SystemTextJson.csproj create mode 100644 framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/AbpJsonSystemTextJsonModule.cs rename framework/src/{Volo.Abp.Json => Volo.Abp.Json.SystemTextJson}/Volo/Abp/Json/SystemTextJson/AbpSystemTextJsonSerializerOptions.cs (100%) rename framework/src/{Volo.Abp.Json => Volo.Abp.Json.SystemTextJson}/Volo/Abp/Json/SystemTextJson/AbpSystemTextJsonSerializerOptionsSetup.cs (100%) rename framework/src/{Volo.Abp.Json => Volo.Abp.Json.SystemTextJson}/Volo/Abp/Json/SystemTextJson/AbpSystemTextJsonSerializerProvider.cs (100%) rename framework/src/{Volo.Abp.Json => Volo.Abp.Json.SystemTextJson}/Volo/Abp/Json/SystemTextJson/AbpSystemTextJsonUnsupportedTypeMatcher.cs (100%) rename framework/src/{Volo.Abp.Json => Volo.Abp.Json.SystemTextJson}/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpDateTimeConverter.cs (95%) rename framework/src/{Volo.Abp.Json => Volo.Abp.Json.SystemTextJson}/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpNullableDateTimeConverter.cs (100%) rename framework/src/{Volo.Abp.Json => Volo.Abp.Json.SystemTextJson}/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpStringToBooleanConverter.cs (100%) rename framework/src/{Volo.Abp.Json => Volo.Abp.Json.SystemTextJson}/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpStringToEnumConverter.cs (100%) rename framework/src/{Volo.Abp.Json => Volo.Abp.Json.SystemTextJson}/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpStringToEnumFactory.cs (100%) rename framework/src/{Volo.Abp.Json => Volo.Abp.Json.SystemTextJson}/Volo/Abp/Json/SystemTextJson/JsonConverters/ObjectToInferredTypesConverter.cs (100%) diff --git a/framework/Volo.Abp.sln b/framework/Volo.Abp.sln index fadd40bcc5..82f67fe15c 100644 --- a/framework/Volo.Abp.sln +++ b/framework/Volo.Abp.sln @@ -409,6 +409,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.RemoteServices", " EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.AspNetCore.Mvc.PlugIn", "test\Volo.Abp.AspNetCore.Mvc.PlugIn\Volo.Abp.AspNetCore.Mvc.PlugIn.csproj", "{C6D6D878-208A-4FD2-822E-365545D8681B}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Json.Newtonsoft", "src\Volo.Abp.Json.Newtonsoft\Volo.Abp.Json.Newtonsoft.csproj", "{9DD41C8F-0886-483C-B98B-C55EAA7F226D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Json.SystemTextJson", "src\Volo.Abp.Json.SystemTextJson\Volo.Abp.Json.SystemTextJson.csproj", "{0AD06E14-CBFE-4551-8D18-9E921D8F2A87}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Json.Core", "src\Volo.Abp.Json.Core\Volo.Abp.Json.Core.csproj", "{08531C5D-0436-4721-986D-96446CF54316}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -1219,6 +1225,18 @@ Global {C6D6D878-208A-4FD2-822E-365545D8681B}.Debug|Any CPU.Build.0 = Debug|Any CPU {C6D6D878-208A-4FD2-822E-365545D8681B}.Release|Any CPU.ActiveCfg = Release|Any CPU {C6D6D878-208A-4FD2-822E-365545D8681B}.Release|Any CPU.Build.0 = Release|Any CPU + {9DD41C8F-0886-483C-B98B-C55EAA7F226D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9DD41C8F-0886-483C-B98B-C55EAA7F226D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9DD41C8F-0886-483C-B98B-C55EAA7F226D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9DD41C8F-0886-483C-B98B-C55EAA7F226D}.Release|Any CPU.Build.0 = Release|Any CPU + {0AD06E14-CBFE-4551-8D18-9E921D8F2A87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0AD06E14-CBFE-4551-8D18-9E921D8F2A87}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0AD06E14-CBFE-4551-8D18-9E921D8F2A87}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0AD06E14-CBFE-4551-8D18-9E921D8F2A87}.Release|Any CPU.Build.0 = Release|Any CPU + {08531C5D-0436-4721-986D-96446CF54316}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {08531C5D-0436-4721-986D-96446CF54316}.Debug|Any CPU.Build.0 = Debug|Any CPU + {08531C5D-0436-4721-986D-96446CF54316}.Release|Any CPU.ActiveCfg = Release|Any CPU + {08531C5D-0436-4721-986D-96446CF54316}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1425,6 +1443,9 @@ Global {3683340D-92F5-4B14-B77B-34A163333309} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} {EDFFDA74-090D-439C-A58D-06CCF86D4423} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} {C6D6D878-208A-4FD2-822E-365545D8681B} = {447C8A77-E5F0-4538-8687-7383196D04EA} + {9DD41C8F-0886-483C-B98B-C55EAA7F226D} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} + {0AD06E14-CBFE-4551-8D18-9E921D8F2A87} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} + {08531C5D-0436-4721-986D-96446CF54316} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {BB97ECF4-9A84-433F-A80B-2A3285BDD1D5} diff --git a/framework/src/Volo.Abp.Json.Core/FodyWeavers.xml b/framework/src/Volo.Abp.Json.Core/FodyWeavers.xml new file mode 100644 index 0000000000..bc5a74a236 --- /dev/null +++ b/framework/src/Volo.Abp.Json.Core/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + diff --git a/framework/src/Volo.Abp.Json.Core/FodyWeavers.xsd b/framework/src/Volo.Abp.Json.Core/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Json.Core/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Json.Core/Volo.Abp.Json.Core.csproj b/framework/src/Volo.Abp.Json.Core/Volo.Abp.Json.Core.csproj new file mode 100644 index 0000000000..b7a88c22f6 --- /dev/null +++ b/framework/src/Volo.Abp.Json.Core/Volo.Abp.Json.Core.csproj @@ -0,0 +1,20 @@ + + + + + + + netstandard2.0 + Volo.Abp.Json.Core + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; + false + false + false + + + + + + + + diff --git a/framework/src/Volo.Abp.Json/Volo/Abp/Json/AbpHybridJsonSerializer.cs b/framework/src/Volo.Abp.Json.Core/Volo/Abp/Json/AbpHybridJsonSerializer.cs similarity index 100% rename from framework/src/Volo.Abp.Json/Volo/Abp/Json/AbpHybridJsonSerializer.cs rename to framework/src/Volo.Abp.Json.Core/Volo/Abp/Json/AbpHybridJsonSerializer.cs diff --git a/framework/src/Volo.Abp.Json.Core/Volo/Abp/Json/AbpJsonCoreModule.cs b/framework/src/Volo.Abp.Json.Core/Volo/Abp/Json/AbpJsonCoreModule.cs new file mode 100644 index 0000000000..68de7be35e --- /dev/null +++ b/framework/src/Volo.Abp.Json.Core/Volo/Abp/Json/AbpJsonCoreModule.cs @@ -0,0 +1,8 @@ +using Volo.Abp.Modularity; + +namespace Volo.Abp.Json; + +public class AbpJsonCoreModule : AbpModule +{ + +} diff --git a/framework/src/Volo.Abp.Json/Volo/Abp/Json/AbpJsonOptions.cs b/framework/src/Volo.Abp.Json.Core/Volo/Abp/Json/AbpJsonOptions.cs similarity index 87% rename from framework/src/Volo.Abp.Json/Volo/Abp/Json/AbpJsonOptions.cs rename to framework/src/Volo.Abp.Json.Core/Volo/Abp/Json/AbpJsonOptions.cs index 74d0c0fb6a..73b1d4506d 100644 --- a/framework/src/Volo.Abp.Json/Volo/Abp/Json/AbpJsonOptions.cs +++ b/framework/src/Volo.Abp.Json.Core/Volo/Abp/Json/AbpJsonOptions.cs @@ -1,5 +1,4 @@ using Volo.Abp.Collections; -using Volo.Abp.Json.SystemTextJson; namespace Volo.Abp.Json; @@ -13,7 +12,6 @@ public class AbpJsonOptions /// /// It will try to use System.Json.Text to handle JSON if it can otherwise use Newtonsoft. /// Affects both AbpJsonModule and AbpAspNetCoreMvcModule. - /// See /// public bool UseHybridSerializer { get; set; } diff --git a/framework/src/Volo.Abp.Json/Volo/Abp/Json/IJsonSerializer.cs b/framework/src/Volo.Abp.Json.Core/Volo/Abp/Json/IJsonSerializer.cs similarity index 100% rename from framework/src/Volo.Abp.Json/Volo/Abp/Json/IJsonSerializer.cs rename to framework/src/Volo.Abp.Json.Core/Volo/Abp/Json/IJsonSerializer.cs diff --git a/framework/src/Volo.Abp.Json/Volo/Abp/Json/IJsonSerializerProvider.cs b/framework/src/Volo.Abp.Json.Core/Volo/Abp/Json/IJsonSerializerProvider.cs similarity index 100% rename from framework/src/Volo.Abp.Json/Volo/Abp/Json/IJsonSerializerProvider.cs rename to framework/src/Volo.Abp.Json.Core/Volo/Abp/Json/IJsonSerializerProvider.cs diff --git a/framework/src/Volo.Abp.Json.Newtonsoft/FodyWeavers.xml b/framework/src/Volo.Abp.Json.Newtonsoft/FodyWeavers.xml new file mode 100644 index 0000000000..bc5a74a236 --- /dev/null +++ b/framework/src/Volo.Abp.Json.Newtonsoft/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + diff --git a/framework/src/Volo.Abp.Json.Newtonsoft/FodyWeavers.xsd b/framework/src/Volo.Abp.Json.Newtonsoft/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Json.Newtonsoft/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Json.Newtonsoft/Volo.Abp.Json.Newtonsoft.csproj b/framework/src/Volo.Abp.Json.Newtonsoft/Volo.Abp.Json.Newtonsoft.csproj new file mode 100644 index 0000000000..d53a9e2b33 --- /dev/null +++ b/framework/src/Volo.Abp.Json.Newtonsoft/Volo.Abp.Json.Newtonsoft.csproj @@ -0,0 +1,23 @@ + + + + + + + netstandard2.0 + Volo.Abp.Json.Newtonsoft + Volo.Abp.Json.Newtonsoft + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; + false + false + false + + + + + + + + + + diff --git a/framework/src/Volo.Abp.Json/Volo/Abp/Json/Newtonsoft/AbpJsonIsoDateTimeConverter.cs b/framework/src/Volo.Abp.Json.Newtonsoft/Volo/Abp/Json/Newtonsoft/AbpJsonIsoDateTimeConverter.cs similarity index 100% rename from framework/src/Volo.Abp.Json/Volo/Abp/Json/Newtonsoft/AbpJsonIsoDateTimeConverter.cs rename to framework/src/Volo.Abp.Json.Newtonsoft/Volo/Abp/Json/Newtonsoft/AbpJsonIsoDateTimeConverter.cs diff --git a/framework/src/Volo.Abp.Json.Newtonsoft/Volo/Abp/Json/Newtonsoft/AbpJsonNewtonsoftModule.cs b/framework/src/Volo.Abp.Json.Newtonsoft/Volo/Abp/Json/Newtonsoft/AbpJsonNewtonsoftModule.cs new file mode 100644 index 0000000000..afa419bba2 --- /dev/null +++ b/framework/src/Volo.Abp.Json.Newtonsoft/Volo/Abp/Json/Newtonsoft/AbpJsonNewtonsoftModule.cs @@ -0,0 +1,21 @@ +using Volo.Abp.Modularity; +using Volo.Abp.Timing; + +namespace Volo.Abp.Json.Newtonsoft; + +[DependsOn(typeof(AbpJsonCoreModule), typeof(AbpTimingModule))] +public class AbpJsonNewtonsoftModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.Providers.Add(); + }); + + Configure(options => + { + options.Converters.Add(); + }); + } +} diff --git a/framework/src/Volo.Abp.Json/Volo/Abp/Json/Newtonsoft/AbpNewtonsoftJsonSerializerOptions.cs b/framework/src/Volo.Abp.Json.Newtonsoft/Volo/Abp/Json/Newtonsoft/AbpNewtonsoftJsonSerializerOptions.cs similarity index 100% rename from framework/src/Volo.Abp.Json/Volo/Abp/Json/Newtonsoft/AbpNewtonsoftJsonSerializerOptions.cs rename to framework/src/Volo.Abp.Json.Newtonsoft/Volo/Abp/Json/Newtonsoft/AbpNewtonsoftJsonSerializerOptions.cs diff --git a/framework/src/Volo.Abp.Json/Volo/Abp/Json/Newtonsoft/AbpNewtonsoftJsonSerializerProvider.cs b/framework/src/Volo.Abp.Json.Newtonsoft/Volo/Abp/Json/Newtonsoft/AbpNewtonsoftJsonSerializerProvider.cs similarity index 100% rename from framework/src/Volo.Abp.Json/Volo/Abp/Json/Newtonsoft/AbpNewtonsoftJsonSerializerProvider.cs rename to framework/src/Volo.Abp.Json.Newtonsoft/Volo/Abp/Json/Newtonsoft/AbpNewtonsoftJsonSerializerProvider.cs diff --git a/framework/src/Volo.Abp.Json.SystemTextJson/FodyWeavers.xml b/framework/src/Volo.Abp.Json.SystemTextJson/FodyWeavers.xml new file mode 100644 index 0000000000..bc5a74a236 --- /dev/null +++ b/framework/src/Volo.Abp.Json.SystemTextJson/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + diff --git a/framework/src/Volo.Abp.Json.SystemTextJson/FodyWeavers.xsd b/framework/src/Volo.Abp.Json.SystemTextJson/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Json.SystemTextJson/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Json.SystemTextJson/Volo.Abp.Json.SystemTextJson.csproj b/framework/src/Volo.Abp.Json.SystemTextJson/Volo.Abp.Json.SystemTextJson.csproj new file mode 100644 index 0000000000..c9aa014c82 --- /dev/null +++ b/framework/src/Volo.Abp.Json.SystemTextJson/Volo.Abp.Json.SystemTextJson.csproj @@ -0,0 +1,22 @@ + + + + + + + netstandard2.0 + Volo.Abp.Json.SystemTextJson + Volo.Abp.Json.SystemTextJson + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; + false + false + false + + + + + + + + + diff --git a/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/AbpJsonSystemTextJsonModule.cs b/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/AbpJsonSystemTextJsonModule.cs new file mode 100644 index 0000000000..4b15408b51 --- /dev/null +++ b/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/AbpJsonSystemTextJsonModule.cs @@ -0,0 +1,26 @@ +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection.Extensions; +using Microsoft.Extensions.Options; +using Volo.Abp.Modularity; +using Volo.Abp.Timing; + +namespace Volo.Abp.Json.SystemTextJson; + +[DependsOn(typeof(AbpJsonCoreModule), typeof(AbpTimingModule))] +public class AbpJsonSystemTextJsonModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.TryAddEnumerable(ServiceDescriptor + .Transient, AbpSystemTextJsonSerializerOptionsSetup>()); + + var preActions = context.Services.GetPreConfigureActions(); + Configure(options => + { + if (preActions.Configure().UseHybridSerializer) + { + options.Providers.Add(); + } + }); + } +} diff --git a/framework/src/Volo.Abp.Json/Volo/Abp/Json/SystemTextJson/AbpSystemTextJsonSerializerOptions.cs b/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/AbpSystemTextJsonSerializerOptions.cs similarity index 100% rename from framework/src/Volo.Abp.Json/Volo/Abp/Json/SystemTextJson/AbpSystemTextJsonSerializerOptions.cs rename to framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/AbpSystemTextJsonSerializerOptions.cs diff --git a/framework/src/Volo.Abp.Json/Volo/Abp/Json/SystemTextJson/AbpSystemTextJsonSerializerOptionsSetup.cs b/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/AbpSystemTextJsonSerializerOptionsSetup.cs similarity index 100% rename from framework/src/Volo.Abp.Json/Volo/Abp/Json/SystemTextJson/AbpSystemTextJsonSerializerOptionsSetup.cs rename to framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/AbpSystemTextJsonSerializerOptionsSetup.cs diff --git a/framework/src/Volo.Abp.Json/Volo/Abp/Json/SystemTextJson/AbpSystemTextJsonSerializerProvider.cs b/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/AbpSystemTextJsonSerializerProvider.cs similarity index 100% rename from framework/src/Volo.Abp.Json/Volo/Abp/Json/SystemTextJson/AbpSystemTextJsonSerializerProvider.cs rename to framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/AbpSystemTextJsonSerializerProvider.cs diff --git a/framework/src/Volo.Abp.Json/Volo/Abp/Json/SystemTextJson/AbpSystemTextJsonUnsupportedTypeMatcher.cs b/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/AbpSystemTextJsonUnsupportedTypeMatcher.cs similarity index 100% rename from framework/src/Volo.Abp.Json/Volo/Abp/Json/SystemTextJson/AbpSystemTextJsonUnsupportedTypeMatcher.cs rename to framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/AbpSystemTextJsonUnsupportedTypeMatcher.cs diff --git a/framework/src/Volo.Abp.Json/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpDateTimeConverter.cs b/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpDateTimeConverter.cs similarity index 95% rename from framework/src/Volo.Abp.Json/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpDateTimeConverter.cs rename to framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpDateTimeConverter.cs index 42af711772..417037e776 100644 --- a/framework/src/Volo.Abp.Json/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpDateTimeConverter.cs +++ b/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpDateTimeConverter.cs @@ -37,9 +37,9 @@ public class AbpDateTimeConverter : JsonConverter, ITransientDependenc throw new JsonException("Reader's TokenType is not String!"); } - if (reader.TryGetDateTime(out var d2)) + if (reader.TryGetDateTime(out var d3)) { - return _clock.Normalize(d2); + return _clock.Normalize(d3); } throw new JsonException("Can't get datetime from the reader!"); diff --git a/framework/src/Volo.Abp.Json/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpNullableDateTimeConverter.cs b/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpNullableDateTimeConverter.cs similarity index 100% rename from framework/src/Volo.Abp.Json/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpNullableDateTimeConverter.cs rename to framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpNullableDateTimeConverter.cs diff --git a/framework/src/Volo.Abp.Json/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpStringToBooleanConverter.cs b/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpStringToBooleanConverter.cs similarity index 100% rename from framework/src/Volo.Abp.Json/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpStringToBooleanConverter.cs rename to framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpStringToBooleanConverter.cs diff --git a/framework/src/Volo.Abp.Json/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpStringToEnumConverter.cs b/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpStringToEnumConverter.cs similarity index 100% rename from framework/src/Volo.Abp.Json/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpStringToEnumConverter.cs rename to framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpStringToEnumConverter.cs diff --git a/framework/src/Volo.Abp.Json/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpStringToEnumFactory.cs b/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpStringToEnumFactory.cs similarity index 100% rename from framework/src/Volo.Abp.Json/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpStringToEnumFactory.cs rename to framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpStringToEnumFactory.cs diff --git a/framework/src/Volo.Abp.Json/Volo/Abp/Json/SystemTextJson/JsonConverters/ObjectToInferredTypesConverter.cs b/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/JsonConverters/ObjectToInferredTypesConverter.cs similarity index 100% rename from framework/src/Volo.Abp.Json/Volo/Abp/Json/SystemTextJson/JsonConverters/ObjectToInferredTypesConverter.cs rename to framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/JsonConverters/ObjectToInferredTypesConverter.cs diff --git a/framework/src/Volo.Abp.Json/Volo.Abp.Json.csproj b/framework/src/Volo.Abp.Json/Volo.Abp.Json.csproj index 76cbe9f28f..fd0408acba 100644 --- a/framework/src/Volo.Abp.Json/Volo.Abp.Json.csproj +++ b/framework/src/Volo.Abp.Json/Volo.Abp.Json.csproj @@ -15,9 +15,8 @@ - - - + + diff --git a/framework/src/Volo.Abp.Json/Volo/Abp/Json/AbpJsonModule.cs b/framework/src/Volo.Abp.Json/Volo/Abp/Json/AbpJsonModule.cs index 77f791cd27..ef9419a784 100644 --- a/framework/src/Volo.Abp.Json/Volo/Abp/Json/AbpJsonModule.cs +++ b/framework/src/Volo.Abp.Json/Volo/Abp/Json/AbpJsonModule.cs @@ -1,34 +1,11 @@ -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.DependencyInjection.Extensions; -using Microsoft.Extensions.Options; -using Volo.Abp.Json.Newtonsoft; +using Volo.Abp.Json.Newtonsoft; using Volo.Abp.Json.SystemTextJson; using Volo.Abp.Modularity; -using Volo.Abp.Timing; namespace Volo.Abp.Json; -[DependsOn(typeof(AbpTimingModule))] +[DependsOn(typeof(AbpJsonNewtonsoftModule), typeof(AbpJsonSystemTextJsonModule))] public class AbpJsonModule : AbpModule { - public override void ConfigureServices(ServiceConfigurationContext context) - { - context.Services.TryAddEnumerable(ServiceDescriptor - .Transient, AbpSystemTextJsonSerializerOptionsSetup>()); - var preActions = context.Services.GetPreConfigureActions(); - Configure(options => - { - options.Providers.Add(); - if (preActions.Configure().UseHybridSerializer) - { - options.Providers.Add(); - } - }); - - Configure(options => - { - options.Converters.Add(); - }); - } }