Class ProtoClientResolution

Namespace
ProtoTest.Core
Assembly
ProtoTest.Core.dll

The name resolution every protocol accessor shares: the client name the call asked for, the application-qualified name a registered client uses, and the lookup that lets a host-registered client stay reachable from inside an [Application].

public static class ProtoClientResolution
Inheritance
ProtoClientResolution
Inherited Members

Methods

Find<TClient>(ProtoExecutionContext, string, string, string, TClient?)

Finds the client for protocol under the scoped qualified name, then the scoped requested name, then under the bare names: a host- or user-registered client stays reachable by its own name. When all of those miss and the requested name is bare, exactly one client of the protocol whose unqualified name equals it resolves from wherever it is registered - the ambient application still wins, and two same-named clients throw naming both qualified candidates. exclude keeps the application's transport from satisfying a name lookup. The returned ResolvedName is the logical (application-qualified, unscoped) name that matched, so endpoint and registration lookups stay on the user's naming; RegisteredName is the exact registry key that was hit, which is the identity the client's trace entity uses.

public static (TClient? Client, string ResolvedName, string? RegisteredName) Find<TClient>(ProtoExecutionContext context, string protocol, string requested, string resolvedName, TClient? exclude = null) where TClient : class

Parameters

context ProtoExecutionContext
protocol string
requested string
resolvedName string
exclude TClient

Returns

(TClient Client, string ResolvedName, string RegisteredName)

Type Parameters

TClient

QualifiedApplication(string)

Returns the application part of an application-qualified client name (App:Client), or null when the name carries no qualification.

public static string? QualifiedApplication(string name)

Parameters

name string

Returns

string

Qualify(string, string?)

Qualifies a client name with its application, so per-application clients never collide.

public static string Qualify(string name, string? applicationName)

Parameters

name string
applicationName string

Returns

string

RegisteredName(ProtoExecutionContext, object)

Returns the registry key a client instance is registered under for this test, or null when it is not registered. Find<TClient>(ProtoExecutionContext, string, string, string, TClient?) returns the key of the client that satisfied a lookup; this form resolves an instance the caller already holds - the application's in-process transport, for example - so its trace entity uses the same identity.

public static string? RegisteredName(ProtoExecutionContext context, object client)

Parameters

context ProtoExecutionContext
client object

Returns

string

RegisteredNames<TClient>(ProtoExecutionContext, string)

Returns the application-qualified names clients of TClient are registered under for protocol, sorted by name. Registry keys are protocol-scoped (Rest:App:Client); the protocol is stripped, so an error lists the names a caller can pass and a bare name can be matched against its unqualified part.

public static IReadOnlyList<string> RegisteredNames<TClient>(ProtoExecutionContext context, string protocol) where TClient : class

Parameters

context ProtoExecutionContext
protocol string

Returns

IReadOnlyList<string>

Type Parameters

TClient

ResolveNames(ProtoExecutionContext, string, string?, string?)

Returns the requested client name - explicit, or the application's binding, or the first registered client for the protocol, or fallback - together with its application-qualified form. Qualification is what keeps per-application clients from colliding; a name the caller already qualified (App:Client) is kept exactly as given, because it names that application and not the ambient one.

public static (string Requested, string ResolvedName) ResolveNames(ProtoExecutionContext context, string protocolName, string? requested = null, string? fallback = null)

Parameters

context ProtoExecutionContext
protocolName string
requested string
fallback string

Returns

(string Requested, string ResolvedName)

ScopedName(string?, string)

Scopes a client name with its protocol, so two protocols can own the same name. This is the name a protocol provider registers its client under and the first name an accessor looks up.

public static string ScopedName(string? protocol, string name)

Parameters

protocol string
name string

Returns

string