Skip to main content

ViewResolver class

Namespace: Arlecchino.Navigation · Assembly: Arlecchino

Turns a route into a view by asking each registered factory in turn. Each screen is built inside its own container scope, so a scoped service is released when the screen goes away.

public sealed class ViewResolver

Constructors

MemberSummary
ViewResolver(IEnumerable<IArlecchinoViewFactory>, IServiceScopeFactory)Creates the resolver.

Methods

MemberSummary
Create(ViewRoute)Builds the view for a route, in a scope of its own.

Constructors in detail

ViewResolver(IEnumerable<IArlecchinoViewFactory>, IServiceScopeFactory)

public ViewResolver(IEnumerable<IArlecchinoViewFactory> factories, IServiceScopeFactory scopes);

Creates the resolver.

Parameters

NameTypeDescription
factoriesIEnumerable<T><IArlecchinoViewFactory>Factories to ask, in the order they were registered.
scopesIServiceScopeFactoryWhere the per-screen scopes come from.

Methods in detail

Create(ViewRoute)

public ActiveView Create(ViewRoute route);

Builds the view for a route, in a scope of its own.

Parameters

NameTypeDescription
routeViewRouteThe route to show.

Returns ActiveView — The view and the scope it lives in; dispose it when navigating away.

Exceptions

TypeThrown when
InvalidOperationExceptionNo factory owns the route; the message names both ways to register it.