Class ChronicleLinkRegistry
- Namespace
- Chronicler
- Assembly
- Chronicler.dll
Maps stable IDs to host-owned values within a recording session.
public sealed class ChronicleLinkRegistry
- Inheritance
-
ChronicleLinkRegistry
- Inherited Members
Remarks
Each lookup uses the declared link type and slot. Slot names are case-sensitive. Null and empty slots select the same default slot.
Constructors
ChronicleLinkRegistry()
public ChronicleLinkRegistry()
Methods
RegisterInstance<T>(string, T, string?)
Associates a value with a stable ID.
public void RegisterInstance<T>(string id, T value, string? slot = null)
Parameters
idstringA case-sensitive ID containing at least one non-whitespace character.
valueTThe value to retain. For reference types, the registry keeps the instance.
slotstringAn optional identity domain. Null or empty selects the default slot.
Type Parameters
TThe declared type used by the recording schema.
Remarks
Registering the same ID for the same type and slot replaces its value in place.
Exceptions
- ArgumentException
idis null, empty, or whitespace.
RegisterResolver<T>(IRecordLinkResolver<T>, string?)
Sets the custom resolver for a link type and slot.
public void RegisterResolver<T>(IRecordLinkResolver<T> resolver, string? slot = null)
Parameters
resolverIRecordLinkResolver<T>The resolver to retain and consult before instance registrations.
slotstringAn optional identity domain. Null or empty selects the default slot.
Type Parameters
TThe declared type used by the recording schema.
Remarks
Replaces any previous resolver in that type and slot.
Exceptions
- ArgumentNullException
resolveris null.
TryGetReferenceId<T>(T, out string?, string?)
Looks up the stable ID for a value.
public bool TryGetReferenceId<T>(T value, out string? id, string? slot = null)
Parameters
valueTThe value to identify in this session.
idstringThe stable ID on success. Otherwise, null.
slotstringThe link's identity domain. Null or empty selects the default slot.
Returns
Type Parameters
TThe declared link type to look up.
Remarks
Consults the custom resolver first. Instance lookup uses reference identity for reference types and default equality for value types. If several registrations match, returns the first in registration order.
TryResolve<T>(string, out T, string?)
Looks up the value for a recorded ID.
public bool TryResolve<T>(string id, out T value, string? slot = null)
Parameters
idstringThe non-null recorded ID. Instance registrations use case-sensitive matching.
valueTThe resolved value on success. Otherwise, the default value of
T.slotstringThe recorded link's identity domain. Null or empty selects the default slot.
Returns
Type Parameters
TThe declared link type to look up.
Remarks
Consults the custom resolver first and falls back to instance registrations on a miss.
Exceptions
- ArgumentNullException
idis null when an instance table is consulted.
UnregisterInstance<T>(string, string?)
Removes an instance registration.
public bool UnregisterInstance<T>(string id, string? slot = null)
Parameters
idstringThe case-sensitive ID of the registration.
slotstringThe registration's identity domain. Null or empty selects the default slot.
Returns
- bool
true if the registration was removed. Returns false for a blank ID or when the type and slot contain no registration for it.
Type Parameters
TThe declared type used to register the value.
Remarks
The custom resolver for the same type and slot remains available.