From f67ab72c0ae6b7a9dcdc847806d648b6d74b0208 Mon Sep 17 00:00:00 2001 From: Erik Ejlskov Jensen Date: Fri, 4 Oct 2019 09:34:53 +0200 Subject: [PATCH] Get Postgres views fixes #233 --- .../EFCorePowerTools/Helpers/EnvDTEHelper.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/GUI/EFCorePowerTools/Helpers/EnvDTEHelper.cs b/src/GUI/EFCorePowerTools/Helpers/EnvDTEHelper.cs index 2d32b402d..52fd891da 100644 --- a/src/GUI/EFCorePowerTools/Helpers/EnvDTEHelper.cs +++ b/src/GUI/EFCorePowerTools/Helpers/EnvDTEHelper.cs @@ -195,16 +195,19 @@ internal static List GetNpgsqlTableNames(string connectio using (var npgsqlConn = new NpgsqlConnection(connectionString)) { npgsqlConn.Open(); + var tablesDataTable = npgsqlConn.GetSchema("Tables"); foreach (DataRow row in tablesDataTable.Rows) { - var schema = row["table_schema"].ToString(); - if (schema != "pg_catalog" - && schema != "information_schema") - { - // TODO: Check if the table has a primary key - result.Add(new TableInformationModel(schema + "." + row["table_name"].ToString(), true)); - } + // TODO: Check if the table has a primary key + result.Add(new TableInformationModel(row["table_schema"].ToString() + "." + row["table_name"].ToString(), true)); + } + + var viewsDataTable = npgsqlConn.GetSchema("Views"); + foreach (DataRow row in viewsDataTable.Rows) + { + // TODO: Check if the table has a primary key + result.Add(new TableInformationModel(row["table_schema"].ToString() + "." + row["table_name"].ToString(), true)); } }