RunicModelContextRegistry class

Namespace Runic.Navigation · Runic.Navigation 0.7.0-preview.5

public sealed class RunicModelContextRegistry

Associates each model identity with the context that owns its mutations.

Remarks

Bind every object that can be independently presented or mutated. The registry cannot infer an arbitrary CLR object graph, so composition roots should bind their root and children together. A second context for the same object is rejected rather than moving a live ViewModel between execution owners.

Properties

Shared

public static RunicModelContextRegistry Shared { get; }

Gets the process-wide registry used by generated bridges and content sessions.

Methods

Acquire

public IRunicModelContextLease Acquire(Func<IRunicModelContext> createContext, params object[] models)

Acquires a context for the supplied model graph. The first lease creates and owns it; later leases for the same graph reuse that context. It is disposed after the final owner lease is released.

Bind

public IRunicModelContextLease Bind(IRunicModelContext context, params object[] models)

Binds the supplied model identities to an application-owned context. Releasing this lease only removes registrations; it never disposes the supplied context.

GetRequired

public IRunicModelContext GetRequired(object model)

Gets the registered context for a model identity.

TryGet

public bool TryGet(object model, out IRunicModelContext? context)

Gets the registered context for a model identity.