For AI agents: the complete documentation index is available at /AchEngine/en/llms.txt, the full documentation bundle is available at /AchEngine/en/llms-full.txt, and this page is available as Markdown at /AchEngine/en/usage/di/index.md.

DI System — Overview

AchEngine provides a small DI abstraction without exposing VContainer directly.

Optional module

The real DI container is enabled only when jp.hadashikick.vcontainer is installed. Without it, ServiceLocator remains usable with manual setup.

Core components

ClassRole
AchEngineScopeScene entry point wrapping VContainer's LifetimeScope
AchEngineInstallerBase class for defining service registrations
IServiceBuilderRegistration interface independent of VContainer
ServiceLocatorStatic facade for resolving services at runtime

Basic flow

ServiceLifetime

public enum ServiceLifetime
{
    Singleton, // One instance per container (default)
    Transient, // A new instance per request
    Scoped,    // One instance per scope
}

Next steps