Skip to content
Merged
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: 2 additions & 0 deletions MaxMind.GeoIP2.UnitTests/DatabaseReaderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,9 @@ public void City_ManyFields()

Assert.Equal(47.2513, response.Location.Latitude);
Assert.Equal(-122.3149, response.Location.Longitude);
#pragma warning disable 0618
Assert.Equal(819, response.Location.MetroCode);
#pragma warning restore 0618
Assert.Equal("America/Los_Angeles", response.Location.TimeZone);

Assert.Equal("98354", response.Postal.Code);
Expand Down
2 changes: 2 additions & 0 deletions MaxMind.GeoIP2.UnitTests/DeserializationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ private static void CanDeserializeInsightsResponse(InsightsResponse insights)
Assert.Equal(1500, insights.Location.AccuracyRadius);
Assert.Equal(44.979999999999997, insights.Location.Latitude);
Assert.Equal(93.263599999999997, insights.Location.Longitude);
#pragma warning disable 0618
Assert.Equal(765, insights.Location.MetroCode);
#pragma warning restore 0618
Assert.Equal("America/Chicago", insights.Location.TimeZone);
Assert.Equal(50000, insights.Location.AverageIncome);
Assert.Equal(100, insights.Location.PopulationDensity);
Expand Down
2 changes: 2 additions & 0 deletions MaxMind.GeoIP2.UnitTests/WebServiceClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,9 @@ public void MissingKeys()
Assert.Null(location.AccuracyRadius);
Assert.Null(location.Latitude);
Assert.Null(location.Longitude);
#pragma warning disable 618
Assert.Null(location.MetroCode);
#pragma warning restore 618
Assert.Null(location.TimeZone);
Assert.Null(location.PopulationDensity);
Assert.Null(location.AverageIncome);
Expand Down
11 changes: 8 additions & 3 deletions MaxMind.GeoIP2/Model/Location.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#region

using MaxMind.Db;
using System;
using System.Text.Json.Serialization;

#endregion
Expand Down Expand Up @@ -33,7 +34,9 @@ public Location(
AccuracyRadius = accuracyRadius;
Latitude = latitude;
Longitude = longitude;
#pragma warning disable 618
MetroCode = metroCode;
#pragma warning restore 618
TimeZone = timeZone;
}

Expand Down Expand Up @@ -81,12 +84,12 @@ public Location(
public double? Longitude { get; internal set; }

/// <summary>
/// The metro code of the location if the location is in the US.
/// MaxMind returns the same metro codes as the
/// <a href="https://developers.google.com/adwords/api/docs/appendix/cities-DMAregions">Google AdWords API</a>.
/// The metro code is a no-longer-maintained code for targeting
/// advertisements in Google.
/// </summary>
[JsonInclude]
[JsonPropertyName("metro_code")]
[Obsolete("Code values are no longer maintained.")]
public int? MetroCode { get; internal set; }

/// <summary>
Expand Down Expand Up @@ -121,7 +124,9 @@ public override string ToString()
+ (AccuracyRadius.HasValue ? "AccuracyRadius=" + AccuracyRadius + ", " : string.Empty)
+ (Latitude.HasValue ? "Latitude=" + Latitude + ", " : string.Empty)
+ (Longitude.HasValue ? "Longitude=" + Longitude + ", " : string.Empty)
#pragma warning disable 618
+ (MetroCode.HasValue ? "MetroCode=" + MetroCode + ", " : string.Empty)
#pragma warning restore 618
+ (TimeZone != null ? "TimeZone=" + TimeZone : "") + "]";
}
}
Expand Down
2 changes: 2 additions & 0 deletions releasenotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ GeoIP2 .NET API Release Notes
reach their end of support from Microsoft. If you are using these versions,
the .NET Standard 2.1 target should continue working for you.
* .NET 9.0 has been added as a target.
* `MetroCode` in `MaxMind.GeoIP2.Model.Location` has been marked `Obsolete`.
The code values are no longer being maintained.

5.2.0 (2023-12-05)
------------------
Expand Down
Loading