Struct ServiceAddress
- Namespace
- IceRpc
- Assembly
- IceRpc.dll
Represents the URI of a service, parsed and processed for easier consumption by invokers. It's used to construct an OutgoingRequest. It is a union of ServiceAddress.Ice and ServiceAddress.IceRpc, the service address of each protocol.
[TypeConverter(typeof(ServiceAddressTypeConverter))]
public readonly struct ServiceAddress : ServiceAddress.IUnionMembers, IUnion, IEquatable<ServiceAddress>
- Implements
- Inherited Members
Constructors
ServiceAddress(Protocol)
Constructs a service address with default values for a protocol.
public ServiceAddress(Protocol protocol)
Parameters
protocolProtocolThe protocol of the new service address.
ServiceAddress(Uri)
Constructs a service address from a URI.
public ServiceAddress(Uri uri)
Parameters
uriUriAn absolute URI whose scheme is a supported protocol.
Remarks
The new service address holds an ServiceAddress.Ice or ServiceAddress.IceRpc variant, depending on
the scheme of uri.
Exceptions
- ArgumentException
Thrown when
uriis not a valid service address URI.
Properties
AltServerAddresses
Gets or initializes the secondary server addresses of this service address.
public ImmutableList<ServerAddress> AltServerAddresses { get; init; }
Property Value
- ImmutableList<ServerAddress>
The secondary server addresses of the variant.
Path
Gets or initializes the path of this service address.
public string Path { get; init; }
Property Value
- string
The path of the variant.
Protocol
Gets the protocol of this service address.
public Protocol Protocol { get; }
Property Value
- Protocol
Ice for an ServiceAddress.Ice service address and IceRpc for an ServiceAddress.IceRpc service address.
ServerAddress
Gets or initializes the main server address of this service address.
public ServerAddress? ServerAddress { get; init; }
Property Value
- ServerAddress?
The main server address of the variant, or null if the variant has no server address.
Methods
Equals(ServiceAddress)
Determines whether the specified service address is equal to this service address.
public bool Equals(ServiceAddress other)
Parameters
otherServiceAddressThe service address to compare with this service address.
Returns
- bool
true if the two service addresses hold equal variants, or both hold no variant; otherwise, false.
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for this service address.
ToString()
Converts this service address into a string.
public override string ToString()
Returns
- string
The URI of the variant, or an empty string when this service address holds no variant.
ToUri()
Converts this service address into a URI.
public Uri ToUri()
Returns
- Uri
The URI of the variant.
Operators
operator ==(ServiceAddress, ServiceAddress)
Determines whether two service addresses are equal.
public static bool operator ==(ServiceAddress left, ServiceAddress right)
Parameters
leftServiceAddressThe first service address.
rightServiceAddressThe second service address.
Returns
operator !=(ServiceAddress, ServiceAddress)
Determines whether two service addresses are not equal.
public static bool operator !=(ServiceAddress left, ServiceAddress right)
Parameters
leftServiceAddressThe first service address.
rightServiceAddressThe second service address.