Ejemplo n.º 1
0
        private List <LgObject> GetTablesAndViews()
        {
            var lgObjects = new List <LgObject>();

#if ORACLE
            using (var connection = new Oracle.ManagedDataAccess.Client.OracleConnection(ConnectionString))
            {
                connection.Open();
                using (DataTable tables = connection.GetSchema("Tables"))
                {
                    foreach (DataRow row in tables.Rows.Cast <DataRow>())
                    {
                        if (!string.Equals(((string)row["OWNER"]), DefaultSchema, StringComparison.CurrentCultureIgnoreCase))
                        {
                            continue;
                        }
                        var obj = new LgObject
                        {
                            IsView     = false,
                            ObjectName = (string)row["TABLE_NAME"]
                        };

                        lgObjects.Add(obj);
                    }
                }

                using (DataTable views = connection.GetSchema("Views"))
                {
                    foreach (DataRow row in views.Rows)
                    {
                        if (!string.Equals(((string)row["OWNER"]), DefaultSchema, StringComparison.CurrentCultureIgnoreCase))
                        {
                            continue;
                        }
                        var obj = new LgObject
                        {
                            IsView     = true,
                            ObjectName = (string)row["VIEW_NAME"]
                        };

                        lgObjects.Add(obj);
                    }
                }
            }
#endif
            return(lgObjects);
        }