logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class ServiceExtensionScriptGenerator

    Code-gen templating for a generated service extension: the service class (per ServiceExtensionCreator.Style), its DI wiring script, the optional replacement task asset, a test stub and a README (mirrors EventDispatcherActionScriptGenerator's templating approach). Every generated type reference is resolved through Serenity.ServiceExtensionCreator.Editor.ServiceExtensionScriptGenerator.FormatType(System.Type), which also records the referenced namespace so the emitted file gets a clean using block instead of fully-qualified names throughout — readable output a developer will immediately edit by hand.

    Inheritance
    object
    ServiceExtensionScriptGenerator
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.ServiceExtensionCreator.Editor
    Assembly: Serenity.ServiceExtensionCreator.Editor.dll
    Syntax
    public static class ServiceExtensionScriptGenerator

    Fields

    KeyValueComplementNote

    The one-line source comment and README note shared wherever a generated key-value backend must state its scope — a key-value store complements core blob persistence, it never replaces it.

    Declaration
    public const string KeyValueComplementNote = "A key-value backend complements core blob persistence but does not replace it: the pre-boot backend seam requires an IBlobStore-producing installer for core persistence (GameSettings/FileLog), so booting with a key-value-only backend falls back to the built-in file backend. Inject the generated store into its consumers (Checkpoint-style constructor injection) directly."
    Field Value
    Type Description
    string

    Methods

    CreateAutoRegisterWiringScript(AggregateDescriptor, Style, string, string, string, string, string, List<string>)

    Declaration
    public static string CreateAutoRegisterWiringScript(AggregateDescriptor descriptor, ServiceExtensionCreator.Style style, string extensionName, string serviceTypeName, string serviceNamespace, string wiringNamespace, string folderPath, List<string> warnings)
    Parameters
    Type Name Description
    AggregateDescriptor descriptor
    ServiceExtensionCreator.Style style
    string extensionName
    string serviceTypeName
    string serviceNamespace
    string wiringNamespace
    string folderPath
    List<string> warnings
    Returns
    Type Description
    string

    CreateBackendDefinitionAsset(string, string, string)

    Creates the UnityPersistenceBackendDefinition asset that activates a generated PersistenceInstaller subclass at boot (Store/Installer kinds) — preconfigured with the subclass's assembly-qualified name, mirroring how CreateReplacementTaskAsset(AggregateDescriptor, string, string) preconfigures a UnityReflectionCallTaskDefinition for the Service kind.

    Declaration
    public static string CreateBackendDefinitionAsset(string installerAssemblyQualifiedName, string folderPath, string desiredFileNameRoot)
    Parameters
    Type Name Description
    string installerAssemblyQualifiedName
    string folderPath
    string desiredFileNameRoot
    Returns
    Type Description
    string

    CreateExtensionPointReadme(ExtensionPointDescriptor, Input, string, GeneratedExtensionPointLayout, List<string>, string)

    Mirrors CreateReadme(AggregateDescriptor, Input, string, GeneratedLayout, List<string>, string) for the Store/Repository/Gateway/Factory/Installer extension point kinds, which document a backend-definition activation step or a manual-substitution caveat instead of a pipeline-profile step.

    Declaration
    public static string CreateExtensionPointReadme(ExtensionPointDescriptor descriptor, ServiceExtensionCreator.Input input, string typeName, ServiceExtensionScriptGenerator.GeneratedExtensionPointLayout layout, List<string> warnings, string folderPath)
    Parameters
    Type Name Description
    ExtensionPointDescriptor descriptor
    ServiceExtensionCreator.Input input
    string typeName
    ServiceExtensionScriptGenerator.GeneratedExtensionPointLayout layout
    List<string> warnings
    string folderPath
    Returns
    Type Description
    string

    CreateInstallerHookWiringScript(InstallerHookWiringRequest, List<string>)

    Generates the wiring subclass for a Repository/Gateway extension point: a subclass of the aggregate's Unity{X}Installer overriding its discovered Create* hook to return the newly generated implementation instead of the built-in one.

    Declaration
    public static string CreateInstallerHookWiringScript(ServiceExtensionScriptGenerator.InstallerHookWiringRequest request, List<string> warnings)
    Parameters
    Type Name Description
    ServiceExtensionScriptGenerator.InstallerHookWiringRequest request
    List<string> warnings
    Returns
    Type Description
    string

    CreatePersistenceInstallerSubclassScript(PersistenceInstallerSubclassRequest, List<string>)

    Generates the persistence backend installer for a Store or Installer extension point: a subclass of PersistenceInstaller overriding HookMethod (InstallBlobStore or InstallKeyValueStore). A key-value hook additionally carries KeyValueComplementNote as a class doc comment, since that scope constraint is invisible in the code itself.

    Declaration
    public static string CreatePersistenceInstallerSubclassScript(ServiceExtensionScriptGenerator.PersistenceInstallerSubclassRequest request, List<string> warnings)
    Parameters
    Type Name Description
    ServiceExtensionScriptGenerator.PersistenceInstallerSubclassRequest request
    List<string> warnings
    Returns
    Type Description
    string

    CreatePipelineReplaceWiringScript(AggregateDescriptor, Style, string, string, string, string, string, List<string>)

    Declaration
    public static string CreatePipelineReplaceWiringScript(AggregateDescriptor descriptor, ServiceExtensionCreator.Style style, string extensionName, string serviceTypeName, string serviceNamespace, string wiringNamespace, string folderPath, List<string> warnings)
    Parameters
    Type Name Description
    AggregateDescriptor descriptor
    ServiceExtensionCreator.Style style
    string extensionName
    string serviceTypeName
    string serviceNamespace
    string wiringNamespace
    string folderPath
    List<string> warnings
    Returns
    Type Description
    string

    CreateReadme(AggregateDescriptor, Input, string, GeneratedLayout, List<string>, string)

    Declaration
    public static string CreateReadme(AggregateDescriptor descriptor, ServiceExtensionCreator.Input input, string serviceTypeName, ServiceExtensionScriptGenerator.GeneratedLayout layout, List<string> warnings, string folderPath)
    Parameters
    Type Name Description
    AggregateDescriptor descriptor
    ServiceExtensionCreator.Input input
    string serviceTypeName
    ServiceExtensionScriptGenerator.GeneratedLayout layout
    List<string> warnings
    string folderPath
    Returns
    Type Description
    string

    CreateReplacementTaskAsset(AggregateDescriptor, string, string)

    Creates the UnityReflectionCallTaskDefinition that invokes the generated Replace method from the initialization pipeline (mirrors CutsceneCreator.CreateInitPipelineTask). Criticality is Degradable so a failed replacement never halts boot.

    Declaration
    public static string CreateReplacementTaskAsset(AggregateDescriptor descriptor, string folderPath, string replacementAssemblyQualifiedName)
    Parameters
    Type Name Description
    AggregateDescriptor descriptor
    string folderPath
    string replacementAssemblyQualifiedName
    Returns
    Type Description
    string

    CreateServiceScript(AggregateDescriptor, Style, string, string, string, List<string>, bool)

    Declaration
    public static string CreateServiceScript(AggregateDescriptor descriptor, ServiceExtensionCreator.Style style, string typeName, string namespaceName, string folderPath, List<string> warnings, bool includeFoundationTriad = true)
    Parameters
    Type Name Description
    AggregateDescriptor descriptor
    ServiceExtensionCreator.Style style
    string typeName
    string namespaceName
    string folderPath
    List<string> warnings
    bool includeFoundationTriad

    True for the Service kind (default): a BusinessFresh stub renders the canonical IService Id/Guid/LogService triad. False for every other ExtensionPointKind — Store, Repository, Gateway and Factory contracts do not extend IService, so a BusinessFresh stub for them must stub every contract member instead, with no synthetic triad.

    Returns
    Type Description
    string

    CreateTestStub(string, string, string, string)

    Declaration
    public static string CreateTestStub(string typeName, string serviceNamespace, string testNamespace, string folderPath)
    Parameters
    Type Name Description
    string typeName
    string serviceNamespace
    string testNamespace
    string folderPath
    Returns
    Type Description
    string
    In this article
    © 2026 Serenity. All Rights Reserved