public static MetadataProviderBase CreateProvider(string providerName, string connectionString, SchemaImporter importer) { DbConnection connection; try { DbProviderFactory factory = DbProviderFactories.GetFactory(providerName); connection = factory.CreateConnection(); connection.ConnectionString = connectionString; } catch (Exception e) { throw new GlException(String.Format("Unable to create connection \"{0}\". Verify provider name", providerName), e); } MetadataProviderBase metaProvider = null; if (connection.GetType().Name.Equals("OracleConnection", StringComparison.InvariantCultureIgnoreCase)) { metaProvider = new MetadataProviderOracle(connection, providerName, importer); } else { throw new GlException("Schema import is not supported for data provider {0}", providerName); } return(metaProvider); }
public virtual void Run() { metaProvider = MetadataProviderBase.CreateProvider(providerName, connectionString, this); metaProvider.Connect(); try { ProcessGenerators(); ProcessEntities(); ProcessForeignKeys(); ProcessIndexes(); } finally { metaProvider.Close(); } md.Document.Save(String.Format("{0}", Path.Combine(Genie.Config.OutDir, outFileName))); }