public sealed class WindowContentSession : IDisposable Experimental instance routing for content ViewModels. The window owns this session and the application or DI scope continues to own the ViewModels.
Constructors
WindowContentSession
public WindowContentSession(IBridgeTransport transport, IRunicViewLocator? viewLocator, CancellationToken operationShutdown, object? rootModel, IRunicModelContext? modelContext) Creates the content session for one window.
Parameters
transportThe window's host transport.
viewLocatorResolves .NET Views for presented content.
operationShutdownCancels window-owned operations when signalled.
rootModelThe window's root ViewModel, if any.
modelContextAn application-owned context, such as the scoped DI context, that the window graph must share. The root model is bound to it; a root already owned by a different context is rejected. When omitted, the root's existing context is reused or the session creates and owns one.
WindowContentSession
public WindowContentSession(IBridgeTransport transport, IRunicViewLocator? viewLocator = null, CancellationToken operationShutdown = default, object? rootModel = null, IRunicModelContext? modelContext = null, ILoggerFactory? loggerFactory = null) Creates the content session for one window.
Parameters
transportThe window's host transport.
viewLocatorResolves .NET Views for presented content.
operationShutdownCancels window-owned operations when signalled.
rootModelThe window's root ViewModel, if any.
modelContextAn application-owned context, such as the scoped DI context, that the window graph must share. The root model is bound to it; a root already owned by a different context is rejected. When omitted, the root's existing context is reused or the session creates and owns one.
loggerFactoryCreates the loggers of this window's Bridges, operations and mounts, and of a model context the session creates. When omitted, failures are written to
Trace.
WindowContentSession
public WindowContentSession(IBridgeTransport transport, WindowContentSessionOptions options) Creates the content session for one window.
Parameters
transportThe window's host transport.
optionsThe session's View locator, model context, logging, clock and id source.
Properties
Interactions
public BridgeInteractionRouter Interactions { get; } Window-owned interaction request router used by optional UI adapters.
ModelContext
public IRunicModelContext? ModelContext { get; } Gets the execution context shared by this window's ViewModel graph. A model already owned by an application-wide graph keeps that existing context when another window attaches to it.
Methods
AttachPresentation
public IDisposable AttachPresentation<TView, TViewModel>(TViewModel viewModel, string route, Func<IBridgeTransport, TViewModel, string, IDisposable> attachBridge, string? contract = null) where TView : class, IRunicView where TViewModel : class Attaches one route Bridge while resolving a fresh logical View for every mounted web presentation. The ViewModel remains application-owned; each mounted View owns only its own attached, mounted, and disposable lifetime.
AttachPresentation
public IDisposable AttachPresentation<TView, TViewModel>(TViewModel viewModel, string route, Func<IBridgeTransport, TViewModel, string, IDisposable> attachBridge, Func<TView> createView) where TView : class, IRunicView where TViewModel : class Variant for an application-owned factory. It must produce a distinct View for concurrently mounted presentations. Returning one already mounted View is rejected with an ownership error.
AttachRootInteractionPresentation
public IDisposable AttachRootInteractionPresentation(string route) Adds trusted presentation acknowledgement for a root bridge route which exposes interactions. Content routes already own this lifecycle through their normal mount and unmount endpoints.
BeginCloseAsync
public ValueTask<BridgeWindowCloseResult> BeginCloseAsync(TimeSpan timeout) Stops new window-owned operation admission, including awaited command routes, and waits up to timeout for accepted work to reach a terminal result. Work still running at the timeout is asked to cancel; call again to wait for it. Content, fields, and routes owned by this session stay intact until the owner later disposes the session.
Remarks
The result's BridgeWindowCloseResult.Completion completes when the remaining operations reach a terminal result. It never faults; the session itself stays alive until its owner disposes it.
Clear
public void Clear(object owner, string property) Clears the content presented for property of owner.
ClearOwner
public void ClearOwner(object owner) Releases every content slot of a parent. Generated parent bridges call this from their own disposal, including while the window disposes, so it is a no-op after the session was disposed.
Dispose
public void Dispose() Detaches all presented content, removes the window's routes and releases its model-context leases.
Expose
public PageReference Expose<T>(string kind, T viewModel, Func<IBridgeTransport, T, string, IDisposable> attach) where T : class Exposes an object in this window. Re-exposing the same object returns the same reference, including after Suspend. The factory is expected to attach a generated ViewModel Bridge using the supplied route prefix.
Forget
public void Forget(object viewModel) Releases identity and routes for an object no longer retained by this window. Like WindowContentSession.ClearOwner, it is a no-op after the session was disposed, because a navigator can retire owned content while its window closes.
Remarks
Forget does not return while another flow is still detaching one of the content's attachments (for example a Present that replaced the slot), so the old routes are gone when it returns. Calling it inside a model turn while the same content detaches off-turn and that detachment needs a model turn can therefore deadlock; a navigator calls it outside turns.
Present
public PageReference Present<T>(object owner, string property, string kind, T viewModel, Func<IBridgeTransport, T, string, IDisposable> attach) where T : class Presents a ViewModel in one content property. Replacing or clearing the property suspends its old endpoint only if no other property in this window still presents that same object.
PresentItem
public PageReference PresentItem<T>(object owner, string property, string kind, T viewModel, Func<IBridgeTransport, T, string, IDisposable> attach) where T : class Retains a collection item by ViewModel identity, so reordering does not detach its route.
PruneCollection
public void PruneCollection(object owner, string property, IReadOnlySet<string> activeIds) Releases collection items omitted by the latest published snapshot.
ReleaseConnection
public void ReleaseConnection(string connectionKey) Releases only mounts owned by a disconnected host client.
Suspend
public void Suspend(object viewModel) Detaches routes while retaining the object's window identity.