Table of Contents

Class AutosaveRuntime

Namespace
Nucs.JsonSettings.Autosave
Assembly
Nucs.JsonSettings.Autosave.dll

The runtime half of AutosaveAttribute. Infrastructure -- called from woven setters, not intended to be called directly.

public static class AutosaveRuntime
Inheritance
AutosaveRuntime
Inherited Members

Methods

OnPropertySet(object, string)

Invoked at the end of every woven instance setter.

public static void OnPropertySet(object instance, string propertyName)

Parameters

instance object

The object whose setter just ran.

propertyName string

The property name, baked in at weave time.

Remarks

This is the whole hot path of autosave, so it is written to bail out as early as possible. In particular it must be inert -- and cheap -- on instances that never had EnableAutosave() called on them, because AutosaveAttribute is woven into the type, not into the instance: every instance of a marked class runs this on every write, including the ones Newtonsoft assigns while deserializing during Load, which happens before any module is attached.

This mirrors what JsonSettingsAutosaveInterceptor.Intercept did after invocation.Proceed(), minus the "is this a set_ method" string test, which the weaver has already answered by construction.