Exemple #1
0
        /// <summary>
        /// 接続を初期化します。
        /// </summary>
        private void initializeConnection(HalationGhostDbConnectSettingLoaderBase loader)
        {
            if (HalationGhostDbAccessBase.connectionSetting == null)
            {
                HalationGhostDbConnectSettingLoaderBase settingLoader = loader;
                if (settingLoader == null)
                {
                    settingLoader = new HalationGhostDbConnectSettingLoaderBase();
                }

                // キャッシュされていない場合は接続設定ファイルを読み込む
                HalationGhostDbAccessBase.connectionSetting = settingLoader.Load();
                if (HalationGhostDbAccessBase.connectionSetting == null)
                {
                    throw new Exception("DBの接続設定ファイルがLoadできません。");
                }
            }

            // 接続する設定ファイル番号を取得
            var num = this.getConnectionNumber();

            if ((HalationGhostDbAccessBase.helper == null) || (!num.HasValue))
            {
                HalationGhostDbAccessBase.helper = DbAccessHelperFactory.CreateHelper(HalationGhostDbAccessBase.connectionSetting, num);
            }

            this.Connection = HalationGhostDbAccessBase.helper.GetConnection();
        }
Exemple #2
0
 /// <summary>デフォルトコンストラクタ。</summary>
 public HalationGhostDbAccessBase(HalationGhostDbConnectSettingLoaderBase loader) : base()
     => this.initializeConnection(loader);