Class SuspensionModule
- Namespace
- Nucs.JsonSettings.Modulation
- Assembly
- Nucs.JsonSettings.dll
The neutral save-suspension state a settings instance carries while some flavour of autosave is enabled: the re-entrancy and loading gates, and the reference-counted suspension machine.
public class SuspensionModule : Module, IDisposable
- Inheritance
-
SuspensionModule
- Implements
- Derived
- Inherited Members
Remarks
This stays in the base package on purpose: SettingsBag's dictionary-backed
autosave drives these gates with the base package alone, through its own
SettingsBagAutosaveModule, and nothing here knows about weaving. The woven
path's module -- the monitored-property set and the notification-binder slot -- derives
from this as AutosaveModule in Nucs.JsonSettings.Autosave, and that
package's SuspendAutosave drives either kind through this shared type, which is
what keeps the two autosave paths from ever drifting apart on re-entrancy or suspension
semantics.
The loading gate is self-managed: Attach(JsonSettings) subscribes to the socket's repopulate events and brackets Nucs.JsonSettings.Modulation.SuspensionModule.IsLoading around every populate, so the load pipeline needs no knowledge of any module type to keep a load from autosaving the half-loaded object back to disk.
Properties
AutosavingState
The state of the autosave module
public virtual AutosavingState AutosavingState { get; set; }
Property Value
UpdatesSuspended
When true, changes will not cause updates.
public virtual bool UpdatesSuspended { get; }
Property Value
Methods
Attach(JsonSettings)
Attaches and self-wires the loading gate: subscribes to the socket's repopulate events so Nucs.JsonSettings.Modulation.SuspensionModule.IsLoading brackets every populate of this instance.
public override void Attach(JsonSettings socket)
Parameters
socketJsonSettings
Deattach(JsonSettings)
public override void Deattach(JsonSettings socket)
Parameters
socketJsonSettings
TryTriggerSave()
Will try to trigger save if this module did not lose reference to JsonSettings socket.
public void TryTriggerSave()