Table of Contents

Class InstanceRegistry

Namespace
DotBoxD.Services.Server
Assembly
DotBoxD.Services.dll

Default IInstanceRegistry. Backed by a single ConcurrentDictionary<TKey, TValue> keyed on (serviceName, instanceId). One registry per connection.

public sealed class InstanceRegistry : IInstanceRegistry
Inheritance
InstanceRegistry
Implements
Inherited Members

Constructors

InstanceRegistry()

public InstanceRegistry()

InstanceRegistry(int)

public InstanceRegistry(int maxInstances)

Parameters

maxInstances int

Methods

Register(string, object)

Registers an instance under serviceName and returns the freshly allocated identifier the client will quote on subsequent calls. serviceName must be non-empty and non-whitespace.

public string Register(string serviceName, object instance)

Parameters

serviceName string
instance object

Returns

string

Release(string, string)

Releases an instance early (the connection-teardown path also clears it). Keys must be non-empty and non-whitespace.

public void Release(string serviceName, string instanceId)

Parameters

serviceName string
instanceId string

ReleaseAll()

Removes every entry — called from the connection-cleanup path.

public void ReleaseAll()

ReleaseAsync(string, string)

Releases an instance early, awaiting async disposal when the instance supports it. Keys must be non-empty and non-whitespace.

public ValueTask ReleaseAsync(string serviceName, string instanceId)

Parameters

serviceName string
instanceId string

Returns

ValueTask

TryGet(string, string, out object)

Looks up an instance previously registered under (serviceName, instanceId). Invalid or unknown keys return false.

public bool TryGet(string serviceName, string instanceId, out object instance)

Parameters

serviceName string
instanceId string
instance object

Returns

bool