Пример #1
0
        ///<inheritdoc/>
        public Guid Save(ConnectorViewModel model)
        {
            var connectionInfo = new Resources.ConnectionInformation
            {
                InitialCatalog = model.InitialCatalog,
                DataSource     = model.DataSource,
                UserId         = model.UserId,
                Password       = model.Password
            };

            model.ConnectionString = _factory.CreateConnectionString(model.ResourceType, connectionInfo);

            Connector connector = _db.Connector.Find(model.Id);

            connector.Name             = model.Name;
            connector.ResourceType     = model.ResourceType;
            connector.Schema           = model.Schema;
            connector.ConnectionString = model.ConnectionString;
            connector.RecordLimit      = model.RecordLimit.Value;
            connector.UserId           = model.UserId;
            connector.InitialCatalog   = model.InitialCatalog;
            connector.DataSource       = model.DataSource;
            connector.Port             = model.Port;
            connector.IsActive         = model.IsActive;

            _db.SaveChanges();

            return(connector.Id);
        }
Пример #2
0
        public void SetConnectionInfo()
        {
            var connInfo = new ConnectionInformation {
                InitialCatalog = "abc"
            };
            var connString = _resourceFactory.CreateConnectionString("type1", connInfo);

            Assert.AreEqual("conn:abc", connString);
        }