Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed all Newtonsoft references #13

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions DigitalTwins-CodeFirst-dotnet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ VisualStudioVersion = 16.0.30114.105
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Telstra.Twins", "Telstra.Twins\Telstra.Twins.csproj", "{C1F33CDE-6D9F-4533-97DA-4168525D48B7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Telstra.Twins.Common", "Telstra.Twins.Common\Telstra.Twins.Common.csproj", "{0B3217F0-CF2D-479B-ADB9-3FB58A1845DE}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{D8068994-FDA6-41F1-9196-59AADA892F11}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Telstra.Twins.Test", "Tests\Telstra.Twins.Test\Telstra.Twins.Test.csproj", "{4E5BF74D-C0EF-4D13-872C-F40FC347AD67}"
Expand Down
16 changes: 0 additions & 16 deletions Telstra.Twins.Common/Telstra.Twins.Common.csproj

This file was deleted.

20 changes: 0 additions & 20 deletions Telstra.Twins/Attributes/DigitalTwinAttribute.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#nullable enable
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
// ReSharper disable InconsistentNaming

namespace Telstra.Twins.Attributes
Expand Down Expand Up @@ -43,29 +41,11 @@ public string GetFullModelId(Type t)
/// <value>The new parent model Id.</value>
public string? ExtendsModelId { get; set; }

/// <summary>
/// Gets or sets the <see cref="Type"/> of the <see cref="NamingStrategy"/>.
/// </summary>
/// <value>The <see cref="Type"/> of the <see cref="NamingStrategy"/>.</value>
public Type? NamingStrategyType
{
get => _namingStrategyType;
set
{
_namingStrategyType = value;
NamingStrategyInstance = null;
}
}

private Type? _namingStrategyType;
internal NamingStrategy? NamingStrategyInstance { get; set; }

/// <summary>
/// Initializes a new instance of the <see cref="DigitalTwinAttribute"/> class.
/// </summary>
public DigitalTwinAttribute()
{
NamingStrategyType = typeof(CamelCaseNamingStrategy);
}
}
}
File renamed without changes.
91 changes: 0 additions & 91 deletions Telstra.Twins/Core/ContextJsonConverter.cs

This file was deleted.

16 changes: 0 additions & 16 deletions Telstra.Twins/DeviceTwin.cs

This file was deleted.

11 changes: 0 additions & 11 deletions Telstra.Twins/DigitalTwinsClient.cs

This file was deleted.

17 changes: 0 additions & 17 deletions Telstra.Twins/EventRouteInfo.cs

This file was deleted.

6 changes: 1 addition & 5 deletions Telstra.Twins/GenericTwin.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Text.Json;
using System.Runtime.Serialization;
using System.Text.Json.Serialization;
using Telstra.Twins.Attributes;

Expand All @@ -13,7 +10,6 @@ public class GenericTwin : TwinBase
{
[TwinOnlyProperty]
[JsonPropertyName("Contents")]
[JsonProperty("Contents")]
[System.Text.Json.Serialization.JsonExtensionData]
public IDictionary<string, object> Contents { get; set; } = new Dictionary<string, object>();
}
Expand Down
3 changes: 1 addition & 2 deletions Telstra.Twins/Helpers/JsonHelpers.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Linq;
Copy link

@jasonshelley jasonshelley Nov 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor to remove JObject.Parse and use alternate method.


namespace Telstra.Twins.Helpers
{
Expand Down
17 changes: 3 additions & 14 deletions Telstra.Twins/Helpers/ReflectionHelpers.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Newtonsoft.Json;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
Expand Down Expand Up @@ -152,11 +151,6 @@ public static string GetTwinPropertyName(this PropertyInfo p)
var customAttribute = p.GetCustomAttribute<JsonPropertyNameAttribute>();
twinPropertyName = customAttribute?.Name;
}
else if (Attribute.IsDefined(p, typeof(JsonPropertyAttribute)))
{
var customAttribute = p.GetCustomAttribute<JsonPropertyAttribute>();
twinPropertyName = customAttribute?.PropertyName;
}

return twinPropertyName ?? p.Name.ToCamelCase();
}
Expand All @@ -172,8 +166,8 @@ public static string GetModelPropertyName(this PropertyInfo p)
}
else if (Attribute.IsDefined(p, typeof(TwinPropertyAttribute)))
{
var modelOnlyPropertyAttribute = p.GetCustomAttribute<JsonPropertyAttribute>();
modelPropertyName = modelOnlyPropertyAttribute?.PropertyName;
var modelOnlyPropertyAttribute = p.GetCustomAttribute<JsonPropertyNameAttribute>();
modelPropertyName = modelOnlyPropertyAttribute?.Name;
}

return modelPropertyName;
Expand All @@ -187,11 +181,6 @@ public static string GetJsonPropertyName(this PropertyInfo p)
{
var jsonNameAttribute = p.GetCustomAttribute<JsonPropertyNameAttribute>();
jsonPropertyName = jsonNameAttribute?.Name;
}
else if (Attribute.IsDefined(p, typeof(JsonPropertyAttribute)))
{
var jsonNameAttribute = p.GetCustomAttribute<JsonPropertyAttribute>();
jsonPropertyName = jsonNameAttribute?.PropertyName;
}

return jsonPropertyName;
Expand Down
52 changes: 0 additions & 52 deletions Telstra.Twins/ITwinsClient.cs

This file was deleted.

7 changes: 1 addition & 6 deletions Telstra.Twins/Models/Content.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Text.Json.Serialization;
using Newtonsoft.Json;

namespace Telstra.Twins.Models
{
Expand All @@ -13,18 +12,14 @@ protected Content(string baseType, string name = null, object schema = null)
}

[System.Text.Json.Serialization.JsonIgnore]
[Newtonsoft.Json.JsonIgnore]
public string BaseType { get; set; }

[JsonProperty("name", Order = -2)]

[JsonPropertyName("name")]
public string Name { get; set; }

[JsonProperty("schema", Order = -1)]
[JsonPropertyName("schema")]
public object Schema { get; set; }

[JsonProperty("@type", Order = -3)]
[JsonPropertyName("@type")]
public virtual object Type { get { return BaseType; } }
}
Expand Down
6 changes: 1 addition & 5 deletions Telstra.Twins/Models/ModelProperty.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Text.Json.Serialization;
using Newtonsoft.Json;
using Telstra.Twins.Serialization;
using System.Text.Json.Serialization;

namespace Telstra.Twins.Models
{
Expand All @@ -15,7 +13,6 @@ public partial class ModelProperty : Content
[Newtonsoft.Json.JsonIgnore]
public string SemanticType { get; set; }

[JsonProperty("@type", Order = -3)]
[JsonPropertyName("@type")]
public override object Type
{
Expand All @@ -27,7 +24,6 @@ public override object Type
}
}

[JsonProperty("unit")]
[JsonPropertyName("unit")]
public string Unit { get; set; }

Expand Down
1 change: 0 additions & 1 deletion Telstra.Twins/Models/TwinMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ namespace Telstra.Twins.Models
public class TwinMetadata : DigitalTwinMetadata
{
// used to suppress model from component serialization
[Newtonsoft.Json.JsonIgnore]
[JsonIgnore]
public bool IsComponent { get; set; } = false;
}
Expand Down
12 changes: 0 additions & 12 deletions Telstra.Twins/Responses/AggregateTwinsResponse.ActionResult.cs

This file was deleted.

Loading