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

DI システム — 概要

AchEngine は VContainer を直接公開せず、シンプルな DI 抽象化を提供します。

オプションモジュール

jp.hadashikick.vcontainer がある場合のみ実際のコンテナが有効です。未導入でも手動設定の ServiceLocator は使用できます。

主な構成要素

クラス役割
AchEngineScopeVContainer の LifetimeScope をラップするシーン入口
AchEngineInstallerサービス登録を定義する基底クラス
IServiceBuilderVContainer に依存しない登録インターフェース
ServiceLocatorランタイム解決用の静的ファサード

基本フロー

ServiceLifetime

public enum ServiceLifetime
{
    Singleton, // コンテナごとに 1 インスタンス
    Transient, // 要求ごとに新規生成
    Scoped,    // スコープごとに 1 インスタンス
}

次のステップ