logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class InstallationContextReuse

    The one answer to "was this system already installed in this composition?". The composition root's bootstrap installs a few systems that a profile built from the canonical boot order lists again, so their steps run twice. The second run hands back what the first one installed instead of building a second service that would split every consumer between two instances.

    Inheritance
    object
    InstallationContextReuse
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.InterfaceAdapters.Interfaces
    Assembly: Serenity.UnityGlobal.InterfaceAdapters.dll
    Syntax
    public static class InstallationContextReuse

    Methods

    TryReuseInstalled<TInstaller, TStepInput>(IUnityInstallationContext, string, TStepInput, out TInstaller)

    Reads the installer an earlier run of the same step published and, when there is one, notes that the system is reused: at verbose level when currentInput equals the input the system was installed from, and with one warning when it differs, since the reused instance ignores it. When no run published one yet, records currentInput as the input this install uses.

    Declaration
    public static bool TryReuseInstalled<TInstaller, TStepInput>(this IUnityInstallationContext installationContext, string systemName, TStepInput currentInput, out TInstaller installedInstaller) where TInstaller : class where TStepInput : class
    Parameters
    Type Name Description
    IUnityInstallationContext installationContext

    The composition the step installs into.

    string systemName

    The system as a boot log names it, such as "Game settings".

    TStepInput currentInput

    The input this run of the step would install from, or null when none was published.

    TInstaller installedInstaller

    The installer the earlier run published, or null when none did.

    Returns
    Type Description
    bool

    True when the system is already installed and the step must return installedInstaller instead of installing again.

    Type Parameters
    Name Description
    TInstaller

    The installer type the step publishes.

    TStepInput

    The input type the step reads; its equality decides whether a later input differs.

    In this article
    © 2026 Serenity. All Rights Reserved