Ejemplo n.º 1
0
        /// <summary>
        /// Creates an instance of the <see cref="IConnectionProvider"/> class.
        /// <paramref name="key"/>.
        /// </summary>
        /// <param name="key">
        /// The name of the provider that should be created
        /// </param>
        /// <returns>
        /// The newly created <see cref="IConnectionProvider"/> object.
        /// </returns>
        /// <exception cref="KeyNotFoundException"></exception>
        /// <remarks>
        /// This method used the <paramref name="key"/> as a index into the list
        /// of providers that was specified in constructor and them uses the found
        /// <see cref=" IProviderNode"/> to construct an instance of the
        /// <see cref="IConnectionProvider"/> class, if a provider with name
        /// <paramref name="key"/> is not found, this method raises a
        /// <see cref="KeyNotFoundException"/> exception.
        /// </remarks>
        public override IConnectionProvider Load(string key)
        {
            IProviderNode provider = providers_[key];

            return(ProviderFactory <IConnectionProviderFactory>
                   .CreateProviderFactory(provider)
                   .CreateProvider(provider.Options.ToDictionary()));
        }