public DbCategory GetDbExplorer(ConnectionSchema conSchema) { DbCategory dbCategory = new DbCategory(); dbCategory.DbName = conSchema.Id; dbCategory.DbTitle = conSchema.Title; if (string.IsNullOrEmpty(dbCategory.DbTitle)) { dbCategory.DbTitle = dbCategory.DbName; } DbConnection conn = null; try { conn = db.GetConnection(conSchema.Id); } catch (Exception e) { dbCategory.Err = e.Message; return(dbCategory); } DataTable dt = conn.GetSchema("Tables"); DataView dv = dt.DefaultView; dv.Sort = "TABLE_NAME"; foreach (DataRowView dr in dv) { ObjectDocket od = new ObjectDocket(); od.Name = dr["TABLE_NAME"].ToString(); od.Title = dr["TABLE_NAME"].ToString(); string tbType = dr["TABLE_TYPE"].ToString(); if (tbType.Equals("VIEW")) { dbCategory.Views.Add(od); } // if (tbType.Equals("TABLE")) else { if (!od.Name.Equals("sysdiagrams", StringComparison.OrdinalIgnoreCase)) { if (!od.Name.Equals("dtproperties", StringComparison.OrdinalIgnoreCase)) { dbCategory.Tables.Add(od); } } } } return(dbCategory); }
public List <ObjectDocket> GetTableSummarise(string folder) { List <ObjectDocket> ret = new List <ObjectDocket>(); string[] tables = XTableSchemaContainer.Instance().GetIDByFolder(folder); for (int i = 0; i < tables.Length; i++) { ObjectDocket tabSum = new ObjectDocket(); tabSum.Name = tables[i]; XTableSchema tabsch = XTableSchemaContainer.Instance().GetItem(tables[i]); tabSum.Title = tabsch.Title; ret.Add(tabSum); } return(ret); }