示例#1
0
        /// <summary>
        /// 接続を初期化します。
        /// </summary>
        private void initializeConnection(DbConnectSettingLoaderBase loader)
        {
            if (connectionSetting == null)
            {
                DbConnectSettingLoaderBase settingLoader = loader ?? new DbConnectSettingLoaderBase();

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

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

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

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