Skip to content

Class InstanceRegistry

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

Default DotBoxD.Services.Server.IInstanceRegistry. Backed by a single System.Collections.Concurrent.ConcurrentDictionary keyed on (serviceName, instanceId). One registry per connection.

public sealed class InstanceRegistry : IInstanceRegistry

objectInstanceRegistry

IInstanceRegistry

object.Equals(object), object.Equals(object, object), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object, object), object.ToString()

public InstanceRegistry()
public InstanceRegistry(int maxInstances)

maxInstances int

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)

serviceName string

instance object

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)

serviceName string

instanceId string

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

public void ReleaseAll()

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)

serviceName string

instanceId string

ValueTask

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)

serviceName string

instanceId string

instance object

bool