Пример #1
0
 public static bool Remove(string name, string type, string conn)
 {
     if (!string.IsNullOrEmpty(name) && DBSchema.DBScheams.Count > 0)
     {
         int tableHash = TableSchema.GetTableHash(name);
         Dictionary <string, string> dic = TableSchema.GetSchemas(conn, type);
         if (dic != null && dic.ContainsKey(name))
         {
             dic.Remove(name);
         }
         if (!string.IsNullOrEmpty(conn))
         {
             int dbHash = ConnBean.GetHashCode(conn);
             if (DBSchema.DBScheams.ContainsKey(dbHash))
             {
                 return(DBSchema.DBScheams[dbHash].Remove(tableHash, type));
             }
         }
         else
         {
             foreach (KeyValuePair <int, DBInfo> item in DBSchema.DBScheams)
             {
                 if (item.Value.Remove(tableHash, type))
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
Пример #2
0
 public static bool Add(string name, string type, string conn)
 {
     if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(type) && DBSchema.DBScheams.Count > 0)
     {
         int tableHash = TableSchema.GetTableHash(name);
         Dictionary <string, string> dic = TableSchema.GetSchemas(conn, type);
         if (dic != null && !dic.ContainsKey(name))
         {
             dic.Add(name, name);
         }
         int dbHash = ConnBean.GetHashCode(conn);
         if (DBSchema.DBScheams.ContainsKey(dbHash))
         {
             return(DBSchema.DBScheams[dbHash].Add(tableHash, type, name));
         }
     }
     return(false);
 }