Esempio n. 1
0
        public async Task <Node> GetHierarchyAsync(string connectionName)
        {
            var connectionEntry = await _connectionStringService.GetConnectionStringEntry(connectionName);

            var schema = await _schemaManagerService.GetSchema(connectionEntry.ProviderName, connectionEntry.ConnectionString);

            var connectionNode = _schemaTreeBuilder.BuildTree(schema);

            connectionNode.Name = connectionName;

            return(connectionNode);
        }
Esempio n. 2
0
        public async Task <SessionModel> OpenSession(string connectionName)
        {
            try
            {
                var entry = await _connectionStringService.GetConnectionStringEntry(connectionName);

                var driver     = _schemaManagerService.GetDriver(entry.ProviderName);
                var connection = await driver.OpenConnection(entry.ConnectionString);

                var session = new SessionModel
                {
                    SessionId   = Guid.NewGuid(),
                    SessionName = entry.Name,
                    Driver      = driver,
                    Connetion   = connection,
                    Schema      = null
                };

                lock (_sessions)
                {
                    _sessions.Add(session);
                }

                return(session);
            }
            catch (Exception thrown)
            {
                Debug.WriteLine(thrown);
                throw;
            }
        }