Skip to content

Commit 936ac0c

Browse files
authored
Add public method to convert InstanceInfo to EurekaServiceInstance (#1613)
1 parent 034e2d0 commit 936ac0c

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/Discovery/src/Eureka/AppInfo/InstanceInfo.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
using System.Collections.ObjectModel;
66
using System.Text.Json;
7+
using Steeltoe.Common.Discovery;
78
using Steeltoe.Discovery.Eureka.Configuration;
89
using Steeltoe.Discovery.Eureka.Transport;
910
using Steeltoe.Discovery.Eureka.Util;
@@ -574,6 +575,11 @@ private static bool IsMetadataEqual(IReadOnlyDictionary<string, string?> left, I
574575
return ReferenceEquals(left, right) || left.SequenceEqual(right, KeyValuePairEqualityComparer<string, string?>.Instance);
575576
}
576577

578+
public IServiceInstance ToServiceInstance()
579+
{
580+
return new EurekaServiceInstance(this);
581+
}
582+
577583
private sealed class KeyValuePairEqualityComparer<TKey, TValue> : IEqualityComparer<KeyValuePair<TKey, TValue>>
578584
{
579585
public static KeyValuePairEqualityComparer<TKey, TValue> Instance { get; } = new();
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
#nullable enable
2+
Steeltoe.Discovery.Eureka.AppInfo.InstanceInfo.ToServiceInstance() -> Steeltoe.Common.Discovery.IServiceInstance!

0 commit comments

Comments
 (0)