Esempio n. 1
0
        /// <summary>
        /// DBからデータを取得して
        /// アプリケーション設定を最新化する
        /// </summary>
        public void ReloadApplicationSettings()
        {
            // 初期化
            if (ApplicationSettings == null)
            {
                ApplicationSettings = new Dictionary <int, Dictionary <string, string> >();
            }
            ApplicationSettings.Clear();

            // パラメータ読み込み
            using (var db = new MApplicationSettingsDbContext(DbContextOptions))
            {
                // データを取得
                var applicationSettings = db.MApplicationSettings;
                foreach (var applicationSetting in applicationSettings)
                {
                    int recordId = applicationSetting.ExchangeId;
                    if (!ApplicationSettings.ContainsKey(recordId))
                    {
                        ApplicationSettings.Add(recordId, new Dictionary <string, string>());
                    }
                    ApplicationSettings[recordId].Add(applicationSetting.Name, applicationSetting.Value);
                }
            }
            // TODO:取引所ごとに項目が異なるので、アクセサを作成すればよい
        }