Class MenuLifecycleResolver
Small, Unity-free policy helper for menu instantiation decisions.
Handles only: effective-mode resolution (including forcing protected menus to preload) and
built/lazy/unknown classification. It intentionally knows nothing about cache, destroy, or theme
policies and introduces no lifecycle-policy object.
Inherited Members
Namespace: Serenity.Menu.Application.Lifecycle
Assembly: Serenity.Menu.Application.dll
Syntax
public static class MenuLifecycleResolver
Methods
Classify(string, ICollection<string>, ICollection<string>)
Classifies a requested menu id against the set of already-built ids and registered lazy ids.
Declaration
public static MenuInstanceState Classify(string menuId, ICollection<string> builtMenuIds, ICollection<string> lazyMenuIds)
Parameters
| Type | Name | Description |
|---|---|---|
| string | menuId | The requested menu id. |
| ICollection<string> | builtMenuIds | Ids of menus whose views are already built; may be null. |
| ICollection<string> | lazyMenuIds | Ids of menus registered as lazy but not yet built; may be null. |
Returns
| Type | Description |
|---|---|
| MenuInstanceState | Available if already built; Lazy if registered lazy; otherwise Unknown. |
ResolveEffectiveMode(MenuInstantiationMode, string, ISet<string>, out bool)
Resolves the effective instantiation mode for a menu. A menu declared
LazyOnFirstOpen whose id is in protectedMenuIds
(the initial and pause menus) is forced to PreloadOnStartup
so it never incurs a first-open hitch at runtime.
Declaration
public static MenuInstantiationMode ResolveEffectiveMode(MenuInstantiationMode declaredMode, string menuId, ISet<string> protectedMenuIds, out bool forcedToPreload)
Parameters
| Type | Name | Description |
|---|---|---|
| MenuInstantiationMode | declaredMode | The mode configured on the menu asset. |
| string | menuId | The menu's id. |
| ISet<string> | protectedMenuIds | Ids that must never be lazy (initial menu, pause menu); may be null. |
| bool | forcedToPreload | True when a lazy menu was forced to preload because it is protected. |
Returns
| Type | Description |
|---|---|
| MenuInstantiationMode | The effective MenuInstantiationMode to use during installation. |