forked from Azure/azure-sdk-for-net
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deserialize custom dimensions from application insights API response.
Fixes Azure#13042
- Loading branch information
1 parent
3b2cc9e
commit ec492e8
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
...Azure.ApplicationInsights.Query/src/Customized/Models/EventsResultDataCustomDimensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Linq; | ||
|
||
namespace Microsoft.Azure.ApplicationInsights.Query.Models | ||
{ | ||
public partial class EventsResultDataCustomDimensions | ||
{ | ||
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value | ||
[JsonExtensionData] | ||
private IDictionary<string, JToken> _customDimensionsValues; | ||
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value | ||
|
||
public IEnumerable<string> Keys => _customDimensionsValues?.Keys; | ||
|
||
public bool TryGetValue(string key, out string value) | ||
{ | ||
if (_customDimensionsValues != null && _customDimensionsValues.TryGetValue(key, out var jToken)) | ||
{ | ||
value = jToken?.ToString(); | ||
return true; | ||
} | ||
value = null; | ||
return false; | ||
} | ||
} | ||
} |