mirror of https://github.com/ogoun/Zero.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.5 KiB
41 lines
1.5 KiB
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace ZeroLevel.Network.Microservices
|
|
{
|
|
/// <summary>
|
|
/// Information about service connection points
|
|
/// </summary>
|
|
public class ServiceEndpointsInfo :
|
|
IEquatable<ServiceEndpointsInfo>
|
|
{
|
|
public string ServiceKey { get; set; }
|
|
public string Version { get; set; }
|
|
public string ServiceGroup { get; set; }
|
|
public string ServiceType { get; set; }
|
|
|
|
public List<ServiceEndpointInfo> Endpoints { get; set; }
|
|
|
|
public bool Equals(ServiceEndpointsInfo other)
|
|
{
|
|
if (other == null) return false;
|
|
if (string.Compare(this.ServiceKey, other.ServiceKey, true) != 0) return false;
|
|
if (string.Compare(this.Version, other.Version, true) != 0) return false;
|
|
if (string.Compare(this.ServiceGroup, other.ServiceGroup, true) != 0) return false;
|
|
if (string.Compare(this.ServiceType, other.ServiceType, true) != 0) return false;
|
|
if (false == CollectionComparsionExtensions.OrderingEquals(this.Endpoints, other.Endpoints, (a, b) => a.Equals(b))) return false;
|
|
return true;
|
|
}
|
|
|
|
public override bool Equals(object obj)
|
|
{
|
|
return this.Equals(obj as ServiceEndpointsInfo);
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return ServiceKey?.GetHashCode() ?? 0 ^ Version?.GetHashCode() ?? 0 ^ ServiceGroup?.GetHashCode() ?? 0 ^ ServiceType?.GetHashCode() ?? 0;
|
|
}
|
|
}
|
|
}
|