Interface IChronicler
- Namespace
- Chronicler
- Assembly
- Chronicler.dll
Defines a recording pass for values, owned state, and stable links.
public interface IChronicler
Properties
Context
Gets the session context for the current chronicler pass.
ChronicleContext Context { get; }
Property Value
- ChronicleContext
The context that supplies stable link registrations and tracks deferred assignments for this pass.
Mode
Gets the direction of the current pass.
SerializationMode Mode { get; }
Property Value
- SerializationMode
Saving reads the schema's current state. Loading applies the recorded state.
Methods
LookDeepStruct<T>(ref T, string)
Records an owned struct inline.
void LookDeepStruct<T>(ref T value, string name) where T : struct, IRecordable
Parameters
valueTThe value to write on save. A present record loads into a fresh value. For missing or null input, the pass runs the schema against an empty record before replacing this value.
namestringThe stable field name shared by saving and loading.
Type Parameters
TThe type of the owned value.
Remarks
If a present record throws while applying its schema, the new value can be partly updated. If applying an empty record throws, the prior value is retained.
LookDeep<T>(ref T, string)
Records an owned class instance.
void LookDeep<T>(ref T value, string name) where T : class, IRecordable
Parameters
valueTThe existing instance to write or populate. A missing or null entry leaves the target untouched.
namestringThe stable field name shared by saving and loading.
Type Parameters
TThe declared type of the owned object.
Remarks
A present entry runs the schema on the existing target instance. A failure can leave that instance partly updated.
Exceptions
- InvalidOperationException
A present entry needs an instance, but the load target is null.
LookLink<T>(ref T, string, string?, RecordLinkResolveMode, Action<T>?)
Processes a named link by stable ID.
void LookLink<T>(ref T value, string name, string? slot = null, RecordLinkResolveMode resolveMode = RecordLinkResolveMode.Immediate, Action<T>? assignLoadedValue = null)
Parameters
valueTThe value to identify on save. On load, receives the resolved value, or the default of
Tfor a missing, null, or queued entry. An unresolved immediate link leaves this value unchanged.namestringThe stable field name to use on both save and load.
slotstringAn optional identity domain. Null or empty selects the default slot.
resolveModeRecordLinkResolveModeWhether a present ID must resolve when read. Defaults to immediate resolution.
assignLoadedValueAction<T>Optional load callback for immediate links. Required when reading a present ID in deferred mode. Receives the resolved value or the default for a missing or null entry.
Type Parameters
TThe declared type used for registry lookup.
Remarks
Use the callback to assign state when a queued link resolves, because the pass cannot update
value after the call returns. See ResolveDeferredLinks().
Exceptions
- InvalidOperationException
A non-null value has no stable ID on save, a present immediate link cannot resolve, or a present deferred link is read without an assignment callback.
LookNullableDeep<T>(ref T?, string)
Records an optional owned struct inline.
void LookNullableDeep<T>(ref T? value, string name) where T : struct, IRecordable
Parameters
valueT?The value to write on save. A missing or null entry clears it on load. A present record is staged before assignment.
namestringThe stable field name shared by saving and loading.
Type Parameters
TThe underlying non-nullable struct type.
Remarks
An absent value is omitted on save. A failure while loading a present record leaves the existing nullable value in place.
LookValue<T>(ref T, string, T?)
Records a leaf value.
void LookValue<T>(ref T value, string name, T? defaultValue = default)
Parameters
valueTThe value to write on save. On load, receives the decoded value or the declared default for a missing or null entry.
namestringThe stable field name shared by saving and loading.
defaultValueTThe schema default. The built-in transports omit null values and values equal to this default when saving.
Type Parameters
TThe type handled by the active transport.
Remarks
Leaf encoding is transport-specific. Record hashes include the current and default values for supported leaf types.