示例#1
0
 public void Save(ConnectionSettings ConnectionSettings)
 {
     if (CurrentConnectionSettings.ServerName == "")
     {
         ConnectionSettingsList.Add(ConnectionSettings);
     }
     CurrentConnectionSettings = ConnectionSettings;
     SettingRepository[ConnectionSettingsListKey] = JsonConvert.SerializeObject(ConnectionSettingsList);
     SettingRepository.Save().Subscribe(
         _ => Console.WriteLine("SettingRepository.Save().onNext()"),
         e => Console.WriteLine("SettingRepository.Save().onError(): " + e.ToString()),
         () => Console.WriteLine("SettingRepository.Save().onCompleted()")
         );
 }
示例#2
0
 public void Load()
 {
     Console.WriteLine("DatabaseDefinitionDumperContext.Load()");
     SettingRepository.Load()
     .Subscribe(_ => {
         Console.WriteLine("SettingRepository[ConnectionSettingsListKey]: " + SettingRepository[ConnectionSettingsListKey]);
         var connectionSettingsList = JsonConvert.DeserializeObject <IList <ConnectionSettings> >(SettingRepository[ConnectionSettingsListKey]);
         Console.WriteLine("ConnectionSettings.Count: " + connectionSettingsList.Count);
         foreach (var connectionSetttings in connectionSettingsList)
         {
             Console.WriteLine("ConnectionSettingsList: " + connectionSetttings.ToConnectionString());
             ConnectionSettingsList.Add(connectionSetttings);
         }
         if (ConnectionSettingsList.Any())
         {
             CurrentConnectionSettings = ConnectionSettingsList[0];
         }
     });
 }