Beispiel #1
0
        private static ConnectionInfo ConvertToConnectionInfo(ConnectionConfigurationElement configurationElement)
        {
            ArgumentChecks.AssertNotNull(configurationElement, nameof(configurationElement));

            var pluginIdentifier = configurationElement.DbServerPluginInfo;
            var pluginResult     = DbServerPluginRegistry.GetPluginByIdentifier(pluginIdentifier);

            if (!pluginResult.HasValue)
            {
                var message = string.Format(
                    CultureInfo.CurrentCulture,
                    Messages.PluginNotFound,
                    pluginIdentifier);

                throw new SnapshotException(message);
            }

            var connection = new ConnectionInfo(
                pluginResult.Value,
                configurationElement.Host,
                configurationElement.UsesIntegratedSecurity,
                configurationElement.UserId,
                configurationElement.Password);

            return(connection);
        }
Beispiel #2
0
        /// <summary>
        /// Determines whether the collection contains an element with the same key as the one specified.
        /// </summary>
        public bool Contains(ConnectionConfigurationElement element)
        {
            ArgumentChecks.AssertNotNull(element, nameof(element));

            var contains = BaseGetAllKeys()
                           .Cast <string>()
                           .Contains(this.GetElementKey(element));

            return(contains);
        }
Beispiel #3
0
        private static ConnectionConfigurationElement ConvertToConfigElement(ConnectionInfo connection)
        {
            ArgumentChecks.AssertNotNull(connection, nameof(connection));

            var element = new ConnectionConfigurationElement
            {
                DbServerPluginInfo = connection.DbServer.PluginIdentifier,
                Host = connection.Host,
                UsesIntegratedSecurity = connection.UsesIntegratedSecurity,
                UserId   = connection.UserId,
                Password = connection.Password
            };

            return(element);
        }
Beispiel #4
0
        /// <summary>
        /// Removes the specified element.
        /// </summary>
        public void Remove(ConnectionConfigurationElement element)
        {
            ArgumentChecks.AssertNotNull(element, nameof(element));

            this.BaseRemove(this.GetElementKey(element));
        }
Beispiel #5
0
        /// <summary>
        /// Adds the specified element.
        /// </summary>
        public void Add(ConnectionConfigurationElement element)
        {
            ArgumentChecks.AssertNotNull(element, nameof(element));

            this.BaseAdd(element);
        }