public List <SchemaData> GetSchemaObjects() { try { connector.Open(); } catch (Exception e) { throw new DatabaseLoaderException("Error opening database connection. See inner exception.", e); } HashSet <string> schemaNames = new HashSet <string>(); List <string> fullTableNames = connector.GetTableNames(); List <string> fullViewNames = connector.GetViewNames(); foreach (string fullName in fullTableNames) { schemaNames.Add(fullName.Split('|')[1]); } foreach (string fullName in fullViewNames) { schemaNames.Add(fullName.Split('|')[1]); } List <SchemaData> schemaDatas = new List <SchemaData>(); foreach (var schema in schemaNames) { List <string> tableNames = new List <string>(); List <string> viewNames = new List <string>(); foreach (string tableName in fullTableNames.Where(f => f.EndsWith("|" + schema))) { tableNames.Add(tableName.Split('|')[0]); } foreach (string viewName in fullViewNames.Where(f => f.EndsWith("|" + schema))) { viewNames.Add(viewName.Split('|')[0]); } schemaDatas.Add(new SchemaData(schema, tableNames, viewNames)); } connector.Close(); return(schemaDatas); }