public bool GetDatabase(SqlBaseItemXml basemodel, SqlServerItemXml item) { var databaselist = DBConfig.GetDatabaseItemXmlConfigList(basemodel, item.Number); var databaselist2 = databaselist.Where(m => m.IsUse == true && m.IsWrite == true).ToList(); foreach (var item2 in databaselist2) { currentdatabase = item2.DatabaseName; currentdatabasenumber = item2.Number; currentconnstrdatabase = DBProxyAction.GetConnStr(basemodel, item, item2); var temp2 = DBProxy.GetDBAccess(item.DBType).DatabaseStorageSize(currentconnstrdatabase, item2.DatabaseName); var temp2count = DBConfig.GetTableXmlConfig(basemodel).SqlTableList.Where(m => m.DataBaseNumber == item2.Number).Count(); if (item2.StorageSize > temp2 && item2.TableNum >= temp2count && GetTable(basemodel, item, item2)) { return(isposition); } else { new ManagerConfig().DatabaseChangeIsWrite(item2); } } if (item.DatabaseNum > databaselist.Count() && item.IsCreate) { var tempdata = DBWrite.AddDatabase(currentconnstrserver, item); currentdatabase = tempdata.DatabaseName; currentdatabasenumber = tempdata.Number; currentconnstrdatabase = DBProxyAction.GetConnStr(basemodel, item, tempdata); var temptable = DBWrite.AddTable(currentconnstrdatabase, item, tempdata); currenttable = temptable.TableName; currenttablenumber = temptable.Number; isposition = true; return(isposition); } else { new ManagerConfig().ServerChangeIsWrite(item); } return(isposition); }
public static List <SqlTableItemXml> GetTableItemXmlConfigList(SqlBaseItemXml basemodel, long DatabaseNumber, bool IsUse = true) { return(DBConfig.GetTableXmlConfig(basemodel).SqlTableList.Where(m => m.IsUse == IsUse && m.DataBaseNumber == DatabaseNumber).ToList()); }
public static SqlTableItemXml GetTableItemXmlConfig(SqlBaseItemXml basemodel, long Number, bool IsUse = true) { return(DBConfig.GetTableXmlConfig(basemodel).SqlTableList.Where(m => m.IsUse == IsUse && m.Number == Number).FirstOrDefault()); }