private void SaveConnection(ConnectionEditorViewModel viewModel) { var connection = new ExplicitConnection(viewModel.Id.GetValueOrDefault(Guid.NewGuid()), viewModel.Label, viewModel.Host, viewModel.AuthorisationKey, viewModel.DatabaseId, viewModel.CollectionId); _explicitConnectionCache.AddOrUpdate(connection); Mode = ConnectionsManagerMode.Selector; }
private void SaveHandler(ConnectionEditorViewModel connectionEditorViewModel, DialogSession dialogSession) { var connection = new ExplicitConnection(connectionEditorViewModel.Id.GetValueOrDefault(Guid.NewGuid()), connectionEditorViewModel.Label, connectionEditorViewModel.Host, connectionEditorViewModel.AuthorisationKey, connectionEditorViewModel.DatabaseId, connectionEditorViewModel.CollectionId); _explicitConnectionCache.AddOrUpdate(connection); dialogSession.Close(connection); }
private static async Task RunGetStarted(IManagementActionsController managementActionsController, IExplicitConnectionCache explicitConnectionCache) { var addDatabaseResult = await managementActionsController.AddDatabase(LocalEmulator.Host, LocalEmulator.AuthorisationKey); if (!addDatabaseResult.IsCompleted) { return; } var addCollectionResult = await managementActionsController.AddCollection(LocalEmulator.Host, LocalEmulator.AuthorisationKey, addDatabaseResult.ItemId); if (!addCollectionResult.IsCompleted) { return; } var explicitConnection = new ExplicitConnection(Guid.NewGuid(), $"localhost:{addDatabaseResult.ItemId}/{addCollectionResult.ItemId}", LocalEmulator.Host, LocalEmulator.AuthorisationKey, addDatabaseResult.ItemId, addCollectionResult.ItemId); explicitConnectionCache.AddOrUpdate(explicitConnection); }