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 : IInstanceRegistryInheritance
Section titled “Inheritance”Implements
Section titled “Implements”Inherited Members
Section titled “Inherited Members”object.Equals(object), object.Equals(object, object), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object, object), object.ToString()
Constructors
Section titled “Constructors”InstanceRegistry()
Section titled “ InstanceRegistry()”public InstanceRegistry()InstanceRegistry(int)
Section titled “ InstanceRegistry(int)”public InstanceRegistry(int maxInstances)Parameters
Section titled “Parameters”maxInstances int
Methods
Section titled “Methods”Register(string, object)
Section titled “ 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
Section titled “Parameters”serviceName string
instance object
Returns
Section titled “Returns”Release(string, string)
Section titled “ 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
Section titled “Parameters”serviceName string
instanceId string
ReleaseAll()
Section titled “ ReleaseAll()”Removes every entry — called from the connection-cleanup path.
public void ReleaseAll()ReleaseAsync(string, string)
Section titled “ 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
Section titled “Parameters”serviceName string
instanceId string
Returns
Section titled “Returns”TryGet(string, string, out object)
Section titled “ 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
Section titled “Parameters”serviceName string
instanceId string
instance object