示例#1
0
        ///<inheritdoc/>
        public void ConfigureAction(Connector connector, OperationType dbAction, string dbObjectName)
        {
            Check.NotNull(connector, nameof(connector));

            Connector    = connector;
            DbObjectName = dbObjectName;

            var connectionInfo = _connctionStringFactory.GetConnectionInformation(Connector.ResourceType, Connector.ConnectionStringDecrypted);

            Connector.SetConnectionInfo(connectionInfo);

            SchemaInitializer.ConfigureAction(connector, dbAction);
        }
示例#2
0
        private void UpdateConnector(string connectorName)
        {
            string connectionString = _appMigrationDb.Database.GetDbConnection().ConnectionString;
            ConnectionInformation connectionInformation = _connectionStringFactory.GetConnectionInformation(_appDbContext.Database);

            var connector = _appDbContext.Connector.SingleOrDefault(c => c.Name == connectorName);

            if (connector != null)
            {
                connector.SetConnectionInfo(connectionInformation);
                connector.ConnectionStringDecrypted = connectionString;
            }

            _appDbContext.SaveChanges();
        }
示例#3
0
        ///<inheritdoc/>
        public ConnectorViewModel GetById(Guid id)
        {
            var model = _db.Connector.Select(c => new ConnectorViewModel
            {
                Id               = c.Id,
                Name             = c.Name,
                ResourceType     = c.ResourceType,
                Schema           = c.Schema,
                ConnectionString = c.ConnectionString,
                RecordLimit      = c.RecordLimit,
                DataSource       = c.DataSource,
                Port             = c.Port,
                IsActive         = c.IsActive
            }).Single(c => c.Id == id);

            var connectionInfo = _factory.GetConnectionInformation(model.ResourceType, model.ConnectionStringDecrypted);

            model.InitialCatalog = connectionInfo.InitialCatalog;
            model.UserId         = connectionInfo.UserId;
            model.DataSource     = connectionInfo.DataSource;
            model.Password       = connectionInfo.Password;

            return(model);
        }
示例#4
0
        public void GetConnectionInfo()
        {
            var connInfo = _resourceFactory.GetConnectionInformation("type1", "parseABC");

            Assert.AreEqual("cat1", connInfo.InitialCatalog);
        }