Interface IUnityInstallationContext
The composition root as seen by one aggregate's installation step: the foundation services every step needs, plus an untyped channel for handing results to the steps that run later.
Namespace: Serenity.InterfaceAdapters.Interfaces
Assembly: Serenity.UnityGlobal.InterfaceAdapters.dll
Syntax
public interface IUnityInstallationContext
Remarks
A typed member here may only name a type from UnityEngine, Serenity.Global.Application,
Serenity.Global.Domain, Serenity.Shared, or this assembly. Everything else travels
through TryGet<TValue>(out TValue) and Set<TValue>(TValue), whose type argument binds in the
calling assembly rather than this one.
This is not a style rule. Aggregate assemblies such as Serenity.UnityUi.Infrastructure already
reference this assembly, so a typed member naming one of their types would close a reference cycle
and fail to compile.
Properties
EventDispatcher
The event dispatcher, installed before any aggregate step runs.
Declaration
IEventDispatcherService EventDispatcher { get; }
Property Value
| Type | Description |
|---|---|
| IEventDispatcherService |
GameSettings
The game settings service, installed before any aggregate step runs.
Declaration
IGameSettingsService GameSettings { get; }
Property Value
| Type | Description |
|---|---|
| IGameSettingsService |
GameWrapper
The object wrapping the game scene's content, or null when the project has none.
Declaration
GameObject GameWrapper { get; }
Property Value
| Type | Description |
|---|---|
| GameObject |
PathService
Resolves the paths the persistence backend writes to.
Declaration
IPathService PathService { get; }
Property Value
| Type | Description |
|---|---|
| IPathService |
PersistenceUseCases
The persistence use cases the backend published, or null when no backend is installed.
Declaration
PersistenceUseCases PersistenceUseCases { get; }
Property Value
| Type | Description |
|---|---|
| PersistenceUseCases |
ServiceLocator
The runtime service locator, installed before any aggregate step runs.
Declaration
IServiceLocator ServiceLocator { get; }
Property Value
| Type | Description |
|---|---|
| IServiceLocator |
TaskBuildContext
The context initialization-pipeline tasks are built against.
Declaration
TaskBuildContext TaskBuildContext { get; }
Property Value
| Type | Description |
|---|---|
| TaskBuildContext |
ViewElementFactory
The factory every view element is created through.
Declaration
UnityViewElementFactory ViewElementFactory { get; }
Property Value
| Type | Description |
|---|---|
| UnityViewElementFactory |
Methods
EnsureViewRouter()
Creates the top-level view router once and registers it, returning the same instance thereafter.
Declaration
IViewRouter EnsureViewRouter()
Returns
| Type | Description |
|---|---|
| IViewRouter | The application's view router. |
GetLogService(Type)
Resolves the log service configured for an installer type, honouring the active log profile.
Declaration
ILogService GetLogService(Type targetInstallerType)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | targetInstallerType | The installer the log route is configured against. |
Returns
| Type | Description |
|---|---|
| ILogService | The routed log service, or null when none could be resolved. |
RegisterService<TService>(TService)
Publishes a service to the initialization container and mirrors it into the locator.
Declaration
void RegisterService<TService>(TService service) where TService : class
Parameters
| Type | Name | Description |
|---|---|---|
| TService | service | The service instance to publish. |
Type Parameters
| Name | Description |
|---|---|
| TService | The type the service is registered and resolved under. |
RegisterViewProvider(IViewProvider)
Registers a provider with the view router, creating the router if no step has yet.
Declaration
void RegisterViewProvider(IViewProvider viewProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| IViewProvider | viewProvider | The subsystem that owns a set of top-level views. |
Set<TValue>(TValue)
Publishes a value for the steps that run later.
Declaration
void Set<TValue>(TValue value) where TValue : class
Parameters
| Type | Name | Description |
|---|---|---|
| TValue | value | The value to publish. |
Type Parameters
| Name | Description |
|---|---|
| TValue | The type later steps will read it under. |
TryGet<TValue>(out TValue)
Reads a value an earlier step published through Set<TValue>(TValue).
Declaration
bool TryGet<TValue>(out TValue value) where TValue : class
Parameters
| Type | Name | Description |
|---|---|---|
| TValue | value | The published value, or null when no step published one. |
Returns
| Type | Description |
|---|---|
| bool | True when a value was published; false when the step that publishes it did not run. |
Type Parameters
| Name | Description |
|---|---|
| TValue | The type the value was published under. |
Remarks
False is the sanctioned way to say "an optional upstream step did not run". Warn through GetLogService(Type) and return; never throw, because a project is allowed to omit a task from its initialization pipeline profile.