Пример #1
0
        /// <summary>
        /// Gets the database metadata associated to the specified provider name.
        /// </summary>
        /// <param name="providerName">Name of the provider.</param>
        /// <returns>The metadata instance for the specified name</returns>
        public override DbMetadata GetDbMetadata(string providerName)
        {
            List <string> deprecatedProviders = new List <string>
            {
                "Npgsql-10",
                "SqlServer-11"
            };

            if (deprecatedProviders.Contains(providerName))
            {
                throw new Exception(providerName + " provider is no longer supported.");
            }

            try
            {
                PropertiesParser    pp       = PropertiesParser.ReadFromEmbeddedAssemblyResource(resourceName);
                NameValueCollection props    = pp.GetPropertyGroup(propertyGroupName + "." + providerName, true);
                DbMetadata          metadata = new DbMetadata();

                ObjectUtils.SetObjectProperties(metadata, props);
                metadata.Init();

                return(metadata);
            }
            catch (Exception ex)
            {
                throw new ArgumentException("Error while reading metadata information for provider '" + providerName + "'", nameof(providerName), ex);
            }
        }
        /// <summary>
        /// Gets the database metadata associated to the specified provider name.
        /// </summary>
        /// <param name="providerName">Name of the provider.</param>
        /// <returns>The metadata instance for the specified name</returns>
        public override DbMetadata GetDbMetadata(string providerName)
        {
            try
            {
                PropertiesParser    pp       = GetPropertiesParser();
                NameValueCollection props    = pp.GetPropertyGroup(providerNamePrefix + "." + providerName, true);
                DbMetadata          metadata = new DbMetadata();

                ObjectUtils.SetObjectProperties(metadata, props);
                metadata.Init();

                return(metadata);
            }
            catch (Exception ex)
            {
                throw new ArgumentException("Error while reading metadata information for provider '" + providerName + "'", nameof(providerName), ex);
            }
        }
Пример #3
0
 ///<summary>
 /// Registers DB metadata information for given provider name.
 ///</summary>
 ///<param name="dbProviderName"></param>
 ///<param name="metadata"></param>
 public static void RegisterDbMetadata(string dbProviderName, DbMetadata metadata)
 {
     dbMetadataLookup[dbProviderName] = metadata;
 }