コード例 #1
0
        TablePreConfig InsertSQLDB(string AppID)
        {
            AngleX.Eureka.InstanceInfo insInfo = AngleX.Eureka.AppXContext.Server.Find(AppID);
            if (insInfo == null)
            {
                throw new AngleX.CustomException("无法找到AppID为" + AppID + "的信息");
            }
            int nID = 0;

            using (var con = SqlHelper.GetConnection(ConfigSetting.ConnectString)) {
                string sqlInsert = string.Format(SqlTemplate.InsertPreConfig, AppID, insInfo.AppName);

                System.Data.DataTable dtID = SqlHelper.ExecuteDataset(con, sqlInsert);
                nID = Convert.ToInt32(dtID.Rows[0][0]);
            }
            TablePreConfig tPre = new TablePreConfig();

            tPre.AppID     = AppID;
            tPre.ID        = nID;
            tPre.TableName = insInfo.AppName;
            return(tPre);
        }
コード例 #2
0
        public AngleX.Eureka.InstanceInfo Find(string AppID)
        {
            AngleX.Eureka.InstanceInfo insR = new AngleX.Eureka.InstanceInfo();

            var appinfo = _db.AppInfo.Find(AppID);

            if (appinfo == null)
            {
                return(null);
            }
            insR.AppID   = AppID;
            insR.AppName = appinfo.AppName;
            var insinfo = _db.InstanceInfo.Where(T => T.AppID == AppID).FirstOrDefault();

            if (insinfo == null)
            {
                return(null);
            }
            insR.Host         = insinfo.Host;
            insR.ID           = insinfo.ID.ToString();
            insR.InstanceName = insinfo.Name;
            insR.Port         = insinfo.Port;
            return(insR);
        }