Skip to content

Commit

Permalink
Move specific CDP4DalJsonSerializer project classes to CDP4JsonSerial…
Browse files Browse the repository at this point in the history
…izer and remove CDP4DalJsonSerializer project
  • Loading branch information
Alexander van Delft committed Nov 26, 2024
1 parent d0e8bd9 commit 53eb823
Show file tree
Hide file tree
Showing 19 changed files with 52 additions and 110 deletions.
6 changes: 0 additions & 6 deletions CDP4-SDK.sln
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CDP4ServicesMessaging.Tests
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CDP4DalCommon", "CDP4DalCommon\CDP4DalCommon.csproj", "{E7CDB217-8442-4FD4-8E87-F4A8BFE9622A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CDP4DalJsonSerializer", "CDP4DalJsonSerializer\CDP4DalJsonSerializer.csproj", "{36C38A02-C1CF-4F4F-AB40-F0A231256B30}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -210,10 +208,6 @@ Global
{E7CDB217-8442-4FD4-8E87-F4A8BFE9622A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E7CDB217-8442-4FD4-8E87-F4A8BFE9622A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E7CDB217-8442-4FD4-8E87-F4A8BFE9622A}.Release|Any CPU.Build.0 = Release|Any CPU
{36C38A02-C1CF-4F4F-AB40-F0A231256B30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{36C38A02-C1CF-4F4F-AB40-F0A231256B30}.Debug|Any CPU.Build.0 = Debug|Any CPU
{36C38A02-C1CF-4F4F-AB40-F0A231256B30}.Release|Any CPU.ActiveCfg = Release|Any CPU
{36C38A02-C1CF-4F4F-AB40-F0A231256B30}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
44 changes: 0 additions & 44 deletions CDP4DalJsonSerializer/CDP4DalJsonSerializer.csproj

This file was deleted.

1 change: 0 additions & 1 deletion CDP4JsonFileDal/CDP4JsonFileDal.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@

<ItemGroup>
<ProjectReference Include="..\CDP4Common\CDP4Common.csproj" />
<ProjectReference Include="..\CDP4DalJsonSerializer\CDP4DalJsonSerializer.csproj" />
<ProjectReference Include="..\CDP4JsonSerializer\CDP4JsonSerializer.csproj" />
<ProjectReference Include="..\CDP4Dal\CDP4Dal.csproj" />
</ItemGroup>
Expand Down
2 changes: 0 additions & 2 deletions CDP4JsonFileDal/JsonFileDal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ namespace CDP4JsonFileDal
using CDP4DalCommon.Protocol.Operations;
using CDP4DalCommon.Protocol.Tasks;

using CDP4DalJsonSerializer;

using CDP4JsonFileDal.Json;

using CDP4JsonSerializer;
Expand Down
1 change: 1 addition & 0 deletions CDP4JsonSerializer/CDP4JsonSerializer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@

<ItemGroup>
<ProjectReference Include="..\CDP4Common\CDP4Common.csproj" />
<ProjectReference Include="..\CDP4DalCommon\CDP4DalCommon.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,22 @@
// </copyright>
// -------------------------------------------------------------------------------------------------------------------------------

namespace CDP4DalJsonSerializer
namespace CDP4JsonSerializer
{
using System;

using CDP4Common.MetaInfo;

using CDP4DalCommon.Protocol.Operations;

using CDP4DalJsonSerializer.JsonConverter;

using CDP4JsonSerializer;
using CDP4JsonSerializer.JsonConverter;

/// <summary>
/// The <see cref="Cdp4DalJsonSerializer" /> is a <see cref="Cdp4JsonSerializer" /> that also supports (de)serialization of
/// <see cref="PostOperation" />
/// The <see cref="Cdp4DalJsonSerializer" /> is a <see cref="CDP4JsonSerializer.Cdp4JsonSerializer" /> that also supports (de)serialization of
/// <see cref="CDP4DalCommon.Protocol.Operations.PostOperation" />
/// </summary>
public class Cdp4DalJsonSerializer : Cdp4JsonSerializer
{
/// <summary>
/// Asserts that the <see cref="PostOperation.Copy"/> have to be ignored
/// Asserts that the <see cref="CDP4DalCommon.Protocol.Operations.PostOperation.Copy"/> have to be ignored
/// </summary>
private readonly bool ignorePostOperationCopyProperty;

Expand All @@ -54,24 +50,24 @@ public class Cdp4DalJsonSerializer : Cdp4JsonSerializer
/// <param name="supportedVersion">
/// The supported version of the data-model
/// </param>
/// <param name="ignorePostOperationCopyProperty">Asserts that the <see cref="PostOperation.Copy"/> have to be ignored</param>
/// <param name="ignorePostOperationCopyProperty">Asserts that the <see cref="CDP4DalCommon.Protocol.Operations.PostOperation.Copy"/> have to be ignored</param>
public Cdp4DalJsonSerializer(IMetaDataProvider metaInfoProvider, Version supportedVersion, bool ignorePostOperationCopyProperty)
{
this.ignorePostOperationCopyProperty = ignorePostOperationCopyProperty;
this.Initialize(metaInfoProvider, supportedVersion);
}

/// <summary>
/// Initializes a new instance of the <see cref="Cdp4JsonSerializer" /> class.
/// Initializes a new instance of the <see cref="CDP4JsonSerializer.Cdp4JsonSerializer" /> class.
/// </summary>
/// <param name="ignorePostOperationCopyProperty">Asserts that the <see cref="PostOperation.Copy"/> have to be ignored</param>
/// <param name="ignorePostOperationCopyProperty">Asserts that the <see cref="CDP4DalCommon.Protocol.Operations.PostOperation.Copy"/> have to be ignored</param>
public Cdp4DalJsonSerializer(bool ignorePostOperationCopyProperty)
{
this.ignorePostOperationCopyProperty = ignorePostOperationCopyProperty;
}

/// <summary>
/// Initialize the <see cref="Cdp4JsonSerializer.JsonSerializerOptions" /> property
/// Initialize the <see cref="CDP4JsonSerializer.Cdp4JsonSerializer.JsonSerializerOptions" /> property
/// </summary>
public override void InitializeJsonSerializerOptions()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
// </copyright>
// -------------------------------------------------------------------------------------------------------------------------------

namespace CDP4DalJsonSerializer.Extensions
namespace CDP4JsonSerializer.Extensions
{
using System.Collections.Generic;
using System.Text.Json;
Expand All @@ -34,16 +34,16 @@ namespace CDP4DalJsonSerializer.Extensions
using CDP4DalCommon.Protocol.Operations;

/// <summary>
/// Extension class for <see cref="JsonElement"/>
/// Extension class for <see cref="System.Text.Json.JsonElement"/>
/// </summary>
public static class JsonElementExtensions
{
/// <summary>
/// Deserialize the content of the <see cref="JsonElement"/> to the <see cref="PostOperation"/>
/// Deserialize the content of the <see cref="System.Text.Json.JsonElement"/> to the <see cref="CDP4DalCommon.Protocol.Operations.PostOperation"/>
/// </summary>
/// <param name="element">The <see cref="JsonElement"/></param>
/// <param name="postOperation">The <see cref="PostOperation"/> that will receive new value properties</param>
/// <param name="serializerOptions">The <see cref="JsonSerializerOptions"/></param>
/// <param name="element">The <see cref="System.Text.Json.JsonElement"/></param>
/// <param name="postOperation">The <see cref="CDP4DalCommon.Protocol.Operations.PostOperation"/> that will receive new value properties</param>
/// <param name="serializerOptions">The <see cref="System.Text.Json.JsonSerializerOptions"/></param>
public static void DeserializePostOperation(this JsonElement element, PostOperation postOperation, JsonSerializerOptions serializerOptions)
{
if (element.TryGetProperty("_delete", out var deleteElement))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
// </copyright>
// -------------------------------------------------------------------------------------------------------------------------------

namespace CDP4DalJsonSerializer.JsonConverter
namespace CDP4JsonSerializer.JsonConverter
{
using System;
using System.IO;
Expand All @@ -31,15 +31,14 @@ namespace CDP4DalJsonSerializer.JsonConverter
using System.Text.Json.Serialization;

using CDP4Common.Polyfills;

using CDP4DalCommon.Protocol.Operations;

using CDP4DalJsonSerializer.Extensions;
using CDP4JsonSerializer.Extensions;

using NLog;

/// <summary>
/// The <see cref="JsonConverter" /> for <see cref="PostOperation" />s
/// The <see cref="System.Text.Json.Serialization.JsonConverter" /> for <see cref="CDP4DalCommon.Protocol.Operations.PostOperation" />s
/// </summary>
public class PostOperationJsonConverter: JsonConverter<PostOperation>
{
Expand All @@ -49,14 +48,14 @@ public class PostOperationJsonConverter: JsonConverter<PostOperation>
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();

/// <summary>
/// Asserts that the <see cref="PostOperation.Copy"/> have to be ignored
/// Asserts that the <see cref="CDP4DalCommon.Protocol.Operations.PostOperation.Copy"/> have to be ignored
/// </summary>
private readonly bool ignoreCopyProperty;

/// <summary>
/// Initializes a new <see cref="PostOperationJsonConverter" /> instance.
/// </summary>
/// <param name="ignoreCopyProperty">Asserts that the <see cref="PostOperation.Copy"/> have to be ignored</param>
/// <param name="ignoreCopyProperty">Asserts that the <see cref="CDP4DalCommon.Protocol.Operations.PostOperation.Copy"/> have to be ignored</param>
public PostOperationJsonConverter(bool ignoreCopyProperty)
{
this.ignoreCopyProperty = ignoreCopyProperty;
Expand All @@ -76,7 +75,7 @@ public override bool CanConvert(Type typeToConvert)
return typeof(PostOperation).QueryIsAssignableFrom(typeToConvert);
}

/// <summary>Reads and converts the JSON to type <see cref="PostOperation"/>.</summary>
/// <summary>Reads and converts the JSON to type <see cref="CDP4DalCommon.Protocol.Operations.PostOperation"/>.</summary>
/// <param name="reader">The reader.</param>
/// <param name="typeToConvert">The type to convert.</param>
/// <param name="options">An object that specifies serialization options to use.</param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

<ItemGroup>
<ProjectReference Include="..\CDP4Common\CDP4Common.csproj" />
<ProjectReference Include="..\CDP4DalJsonSerializer\CDP4DalJsonSerializer.csproj" />
<ProjectReference Include="..\CDP4Dal\CDP4Dal.csproj" />
<ProjectReference Include="..\CDP4ServicesDal\CDP4ServicesDal.csproj" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion CDP4ServicesDal.NetCore.Tests/CdpServicesDalTestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ public async Task VerifyWriteLongRunningTask()
requestHandler.Respond(_ => thingsResponse);

var stream = new MemoryStream();
this.dal.Cdp4JsonSerializer.SerializeToStream(this.iteration, stream, true);
this.dal.Cdp4DalJsonSerializer.SerializeToStream(this.iteration, stream, true);
stream.Position = 0;
thingsResponse.Content = new StreamContent(stream);
SetHttpHeader(thingsResponse, "application/json");
Expand Down
2 changes: 1 addition & 1 deletion CDP4ServicesDal.NetCore.Tests/PostOperationTestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace CDP4ServicesDal.Tests

using CDP4DalCommon.Protocol.Operations;

using CDP4DalJsonSerializer;
using CDP4JsonSerializer;

using CDP4ServicesDal.Tests.Helper;

Expand Down
2 changes: 1 addition & 1 deletion CDP4ServicesDal.Tests/CdpServicesDalTestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ public async Task VerifyWriteLongRunningTask()
requestHandler.Respond(_ => thingsResponse);

var stream = new MemoryStream();
this.dal.Cdp4JsonSerializer.SerializeToStream(this.iteration, stream, true);
this.dal.Cdp4DalJsonSerializer.SerializeToStream(this.iteration, stream, true);
stream.Position = 0;
thingsResponse.Content = new StreamContent(stream);
SetHttpHeader(thingsResponse, "application/json");
Expand Down
2 changes: 1 addition & 1 deletion CDP4ServicesDal.Tests/PostOperationTestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace CDP4ServicesDal.Tests

using CDP4DalCommon.Protocol.Operations;

using CDP4DalJsonSerializer;
using CDP4JsonSerializer;

using CDP4ServicesDal.Tests.Helper;

Expand Down
2 changes: 1 addition & 1 deletion CDP4ServicesDal/CDP4ServicesDal.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@

<ItemGroup>
<ProjectReference Include="..\CDP4Common\CDP4Common.csproj" />
<ProjectReference Include="..\CDP4DalJsonSerializer\CDP4DalJsonSerializer.csproj" />
<ProjectReference Include="..\CDP4Dal\CDP4Dal.csproj" />
<ProjectReference Include="..\CDP4JsonSerializer\CDP4JsonSerializer.csproj" />
<ProjectReference Include="..\CDP4MessagePackSerializer\CDP4MessagePackSerializer.csproj" />
</ItemGroup>

Expand Down
Loading

0 comments on commit 53eb823

Please sign in to comment.