Exemplo n.º 1
0
        public GremlinConsole(GizmoConfig settings, IInteractiveConsole console)
        {
            _settings = settings;
            _console  = console;

            _connection = new ConnectionManager(_settings, _console);
        }
Exemplo n.º 2
0
 public CommandDefinitions(GizmoConfig settings, IInteractiveConsole console, ConnectionManager connectionManager)
 {
     _settings           = settings;
     _console            = console;
     _connectionManager  = connectionManager;
     _connectionCommands = new ConnectionCommands(settings, console);
 }
Exemplo n.º 3
0
        public CommandDefinitionTest()
        {
            var console           = new InteractiveConsole();
            var settings          = new GizmoConfig();
            var connectionManager = new ConnectionManager(settings, console);

            definitions = new CommandDefinitions(settings, console, connectionManager);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
0
 public ConnectionCommands(GizmoConfig settings, IConsole console)
 {
     _settings = settings;
     _console  = console;
 }
Exemplo n.º 8
0
 public ConnectionManager(GizmoConfig settings, IConsole console)
 {
     _settings = settings;
     _console  = console;
 }