示例#1
0
        /// <summary>
        /// Returns a <see cref="IDcilSchemaProvider"/> object from given connection and data provider
        /// </summary>
        /// <param name="connection">The IDbConnection to use to retrieve the information</param>
        /// <param name="dataProviderName">The invariant name of the Data Provider</param>
        /// <returns><see cref="IDcilSchemaProvider"/></returns>
        public static IDcilSchemaProvider GetDcilSchemaProvider(IDbConnection connection, string dataProviderName)
        {
            IDcilSchemaProvider provider = null;

            switch (dataProviderName)
            {
            case "MySql.Data.MySqlClient":
                provider = new MySqlDcilSchemaProvider(connection);
                break;

            case "System.Data.SqlClient":
                provider = new SqlServer2005DcilSchemaProvider(connection);
                break;

            case "Oracle.DataAccess.Client":
            case "System.Data.OracleClient":
                provider = new OracleDcilSchemaProvider(connection);
                break;
            }
            if (provider == null)
            {
                throw new NotSupportedException("The specified invariant name is not supported.");
            }
            return(provider);
        }
示例#2
0
		/// <summary>
		/// Returns a <see cref="IDcilSchemaProvider"/> object from given connection and data provider
		/// </summary>
		/// <param name="connection">The IDbConnection to use to retrieve the information</param>
		/// <param name="dataProviderName">The invariant name of the Data Provider</param>
		/// <returns><see cref="IDcilSchemaProvider"/></returns>
		public static IDcilSchemaProvider GetDcilSchemaProvider(IDbConnection connection, string dataProviderName)
		{
			IDcilSchemaProvider provider = null;
			switch (dataProviderName)
			{
				case "MySql.Data.MySqlClient":
					provider = new MySqlDcilSchemaProvider(connection);
					break;
				case "System.Data.SqlClient":
					provider = new SqlServer2005DcilSchemaProvider(connection);
					break;
			}
			if (provider == null) throw new NotSupportedException("The specified invariant name is not supported.");
			return provider;
		}