Skip to content

Commit 4164eb0

Browse files
committed
Move shared helpers into Geocoding.Extensions
Root cause: the first split kept a compatibility shim and legacy JSON method casing, which preserved old entry points but did not match the requested .Extensions namespace layout or the desired .NET-style naming for JSON helpers.
1 parent 51b7fc7 commit 4164eb0

15 files changed

Lines changed: 26 additions & 149 deletions

src/Geocoding.Core/Extensions.cs

Lines changed: 0 additions & 58 deletions
This file was deleted.

src/Geocoding.Core/Extensions/CollectionExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Diagnostics.CodeAnalysis;
22

3-
namespace Geocoding.Collections;
3+
namespace Geocoding.Extensions;
44

55
/// <summary>
66
/// Collection-related helpers.

src/Geocoding.Core/Extensions/EnumerableExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace Geocoding.Collections;
1+
namespace Geocoding.Extensions;
22

33
/// <summary>
44
/// Enumerable-related helpers.

src/Geocoding.Core/Extensions/JsonExtensions.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
using System.Text.Json;
22
using System.Text.Json.Serialization;
3-
namespace Geocoding.Serialization;
3+
using Geocoding.Serialization;
4+
5+
namespace Geocoding.Extensions;
46

57
/// <summary>
68
/// JSON serialization helpers and shared serializer options.
@@ -19,7 +21,7 @@ public static class JsonExtensions
1921
/// </summary>
2022
/// <param name="value">The object to serialize.</param>
2123
/// <returns>The JSON payload, or an empty string when the input is null.</returns>
22-
public static string ToJSON(object? value)
24+
public static string ToJson(object? value)
2325
{
2426
if (value is null)
2527
return String.Empty;
@@ -33,7 +35,7 @@ public static string ToJSON(object? value)
3335
/// <typeparam name="T">The destination type.</typeparam>
3436
/// <param name="json">The JSON payload.</param>
3537
/// <returns>A deserialized instance, or default value for blank input.</returns>
36-
public static T? FromJSON<T>(string? json)
38+
public static T? FromJson<T>(string? json)
3739
{
3840
if (String.IsNullOrWhiteSpace(json))
3941
return default;

src/Geocoding.Here/HereGeocoder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System.Text;
55
using System.Text.Json;
66
using System.Text.Json.Serialization;
7-
using Geocoding.Serialization;
7+
using Geocoding.Extensions;
88

99
namespace Geocoding.Here;
1010

src/Geocoding.MapQuest/BaseRequest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Text;
22
using System.Text.Json.Serialization;
3-
using Geocoding.Serialization;
3+
using Geocoding.Extensions;
44

55
namespace Geocoding.MapQuest;
66

@@ -135,7 +135,7 @@ public virtual string RequestBody
135135
{
136136
get
137137
{
138-
return JsonExtensions.ToJSON(this);
138+
return JsonExtensions.ToJson(this);
139139
}
140140
}
141141

src/Geocoding.MapQuest/BatchGeocodeRequest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using System.Text.Json.Serialization;
2-
using Geocoding.Collections;
2+
using Geocoding.Extensions;
33

44
namespace Geocoding.MapQuest;
55

src/Geocoding.MapQuest/MapQuestGeocoder.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
using System.Net;
22
using System.Net.Http;
33
using System.Text;
4-
using Geocoding.Collections;
5-
using Geocoding.Serialization;
4+
using Geocoding.Extensions;
65

76
namespace Geocoding.MapQuest;
87

@@ -227,7 +226,7 @@ private async Task<MapQuestResponse> Parse(HttpClient client, HttpRequestMessage
227226
if (String.IsNullOrWhiteSpace(json))
228227
throw new Exception("Remote system response with blank: " + requestInfo);
229228

230-
MapQuestResponse? o = JsonExtensions.FromJSON<MapQuestResponse>(json);
229+
MapQuestResponse? o = JsonExtensions.FromJson<MapQuestResponse>(json);
231230
if (o is null)
232231
throw new Exception("Unable to deserialize remote response: " + requestInfo);
233232

src/Geocoding.Microsoft/AzureMapsGeocoder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System.Net.Http;
55
using System.Text.Json;
66
using System.Text.Json.Serialization;
7-
using Geocoding.Serialization;
7+
using Geocoding.Extensions;
88

99
namespace Geocoding.Microsoft;
1010

src/Geocoding.Microsoft/BingMapsGeocoder.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
using System.Linq;
55
using System.Text;
66
using System.Text.Json;
7-
using Geocoding.Collections;
8-
using Geocoding.Serialization;
7+
using Geocoding.Extensions;
98

109
namespace Geocoding.Microsoft;
1110

0 commit comments

Comments
 (0)