private void Init()
        {
            try {
                //_log.WriteInformationLog("Initializing DBAppSettingsRepository");

                AppSettingsDictionary.Reset();

                List <Setting> settings = ReadAll();

                AppSettingsDictionary.AddSettings(settings.Where(s => s.Key.Equals(KEY_UPDATEFLAG, StringComparison.InvariantCultureIgnoreCase) == false)
                                                  .ToDictionary(s => s.Key, s => s.Value));

                Setting updateFlag = settings.Where(s => s.Key.Equals(KEY_UPDATEFLAG, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault();

                if (updateFlag != null)
                {
                    AppSettingsDictionary.UniqueValue = new StringBuilder(updateFlag.Value);
                }
                else
                {
                    AppSettingsDictionary.UniqueValue = new StringBuilder(string.Empty);
                }

                AppSettingsDictionary.UniqueCheck = DateTime.Now;

                //_log.WriteInformationLog(" DBAppSettingsRepository, " + AppSettingsDictionary.CountSettings + " settings");
                //_log.WriteInformationLog("Init DBAppSettingsRepository Complete");
            } catch (Exception ex) {
                _log.WriteErrorLog("Failed to initialize DBAppSettingsRepository", ex);
            }
        }
        private string GetInstanceValue(string key, string defaultval)
        {
            CheckForAppSettingsChange();

            try {
                string val = AppSettingsDictionary.GetSetting(key);

                if (val == null)
                {
                    return(defaultval);
                }

                return(val);
            } catch (Exception ex) {
                _log.WriteErrorLog(" DBAppSettingsRepository[" + key + "]", ex);
                return(null);
            }
        }