public GremlinConsole(GizmoConfig settings, IInteractiveConsole console) { _settings = settings; _console = console; _connection = new ConnectionManager(_settings, _console); }
public CommandDefinitions(GizmoConfig settings, IInteractiveConsole console, ConnectionManager connectionManager) { _settings = settings; _console = console; _connectionManager = connectionManager; _connectionCommands = new ConnectionCommands(settings, console); }
public CommandDefinitionTest() { var console = new InteractiveConsole(); var settings = new GizmoConfig(); var connectionManager = new ConnectionManager(settings, console); definitions = new CommandDefinitions(settings, console, connectionManager); }
public async Task <int> AddConnection(string connectionName, CosmosDbConnection connection, bool global = false) { string configPath = global ? GizmoConfig.ProfileConfigPath : GizmoConfig.LocalConfigPath; _console.WriteLine($"Adding {connectionName} to {configPath}"); var settings = await GizmoConfig.LoadConfig(configPath); settings.CosmosDbConnections[connectionName] = connection; await GizmoConfig.SaveConfig(configPath, settings); return(0); }
public async Task <int> RemoveConnection(string connectionName, bool global) { string configPath = global ? GizmoConfig.ProfileConfigPath : GizmoConfig.LocalConfigPath; _console.WriteLine($"Removing {connectionName} from {configPath}"); var settings = await GizmoConfig.LoadConfig(configPath); settings.CosmosDbConnections.Remove(connectionName); await GizmoConfig.SaveConfig(configPath, settings); return(0); }
private static IContainer BuildContainer() { var containerBuilder = new ContainerBuilder(); containerBuilder.RegisterType <InteractiveConsole>().As <IInteractiveConsole>().As <IConsole>().SingleInstance(); containerBuilder.Register(c => { var builder = GetConfig(); var settings = new GizmoConfig(); builder.Bind(settings); return(settings); }).As <GizmoConfig>(); containerBuilder.RegisterType <CommandDefinitions>().AsSelf(); containerBuilder.RegisterType <ConnectionManager>().AsSelf().SingleInstance(); var container = containerBuilder.Build(); return(container); }
public ConnectionCommands(GizmoConfig settings, IConsole console) { _settings = settings; _console = console; }
public ConnectionManager(GizmoConfig settings, IConsole console) { _settings = settings; _console = console; }