Table of Contents

Class AutoOverlayAttribute

Namespace
Nalu
Assembly
Nalu.Maui.Scaffold.dll

Tunes how the Nalu scaffold source generator registers an overlay (the generated AddOverlays()).

[AttributeUsage(AttributeTargets.Class)]
public sealed class AutoOverlayAttribute : Attribute
Inheritance
AutoOverlayAttribute
Inherited Members

Remarks

Without the attribute, any class whose public constructor takes IOverlayRef is discovered automatically: a View subclass registers as a VIEW-ONLY overlay (AddOverlay<TView>()); any other class is an overlay MODEL whose view is resolved from a View constructor taking the model type (ties broken by the view assigning it to BindingContext), else the FooModel → FooView / FooModel → Foo naming convention. Abstract and generic classes are never discovered. The attribute opts IN a class the anchor misses, opts OUT a false positive (Enabled), or names the view explicitly.

Constructors

AutoOverlayAttribute(Type?)

Tunes how the Nalu scaffold source generator registers an overlay (the generated AddOverlays()).

public AutoOverlayAttribute(Type? viewType = null)

Parameters

viewType Type

Optional explicit view type for a model — overrides constructor/naming-convention view resolution (useful when several views take the same model). Ignored when the attributed class is itself a View; must be a concrete, non-generic View (anything else raises a generator diagnostic).

Remarks

Without the attribute, any class whose public constructor takes IOverlayRef is discovered automatically: a View subclass registers as a VIEW-ONLY overlay (AddOverlay<TView>()); any other class is an overlay MODEL whose view is resolved from a View constructor taking the model type (ties broken by the view assigning it to BindingContext), else the FooModel → FooView / FooModel → Foo naming convention. Abstract and generic classes are never discovered. The attribute opts IN a class the anchor misses, opts OUT a false positive (Enabled), or names the view explicitly.

Properties

Enabled

Whether the automatic registration is enabled for this class. Defaults to true. When false the class is skipped by the generated AddOverlays(); it can still be registered manually via AddOverlay<TModel, TView>().

public bool Enabled { get; set; }

Property Value

bool

ViewType

Gets the explicit view type; null resolves the view automatically.

public Type? ViewType { get; }

Property Value

Type