Class NavigationRestoreOptions
- Namespace
- Nalu
- Assembly
- Nalu.Maui.Navigation.dll
Configures navigation-state snapshot & restore inside
builder.UseNaluNavigationRestore(...).
public sealed class NavigationRestoreOptions
- Inheritance
-
NavigationRestoreOptions
- Inherited Members
Properties
Enabled
Whether restore is active. Defaults to true (calling UseNaluNavigationRestore is
the opt-in); the library cannot see the app's build configuration, so a DEBUG-only policy
is expressed app-side: options.Enabled = isDebugBuild (or wrap the whole
UseNaluNavigationRestore call in #if DEBUG).
public bool Enabled { get; set; }
Property Value
IntentSerializerContext
Optional source-generated JsonSerializerContext used by the default IIntentSerializer instead of reflection — required for NativeAOT. Every type registered via AddIntent<T>(string?) must be included in the context.
public JsonSerializerContext? IntentSerializerContext { get; set; }
Property Value
MaxAge
Discards snapshots older than this age at boot. Null (the default) never expires — appropriate for the DEBUG developer-experience use; production apps usually want one.
public TimeSpan? MaxAge { get; set; }
Property Value
Methods
AddIntent<T>(string?)
Registers an intent type under a stable snapshot type id (never an assembly-qualified type name: renames only invalidate, they never deserialize the wrong thing). Only registered intent types are restorable — the registration also preserves the type's constructors, properties and fields under trimming, so the default JSON serializer round-trips it reliably. Exclude non-serializable properties with JsonIgnoreAttribute and rehydrate them on restore via IIntentHydrator<TIntent>.
public NavigationRestoreOptions AddIntent<T>(string? typeId = null)
Parameters
typeIdstringThe stable id; defaults to the type's short name. Collision-checked.
Returns
Type Parameters
TThe intent type.