예제 #1
0
 /// <summary>
 /// 初始化数据库信息
 /// </summary>
 public void InitDBConfig()
 {
     if (_currentDBConfigInfo == null)
     {
         _currentDBConfigInfo = FrmDBSetting.GetDBConfigInfo(DesignerInfo, Namespace + ".DataAccess");
     }
 }
예제 #2
0
        /// <summary>
        /// 加载数据库配置信息
        /// </summary>
        /// <param name="doc"></param>
        /// <returns></returns>
        public static DBConfigInfo LoadInfo(XmlDocument doc)
        {
            XmlNodeList lstConfig = doc.GetElementsByTagName("config");

            if (lstConfig.Count > 0)
            {
                DBConfigInfo info   = new DBConfigInfo();
                XmlNode      config = lstConfig[0];

                XmlAttribute att = config.Attributes["connectionString"];
                if (att != null)
                {
                    info.ConnectionString = att.InnerText;
                }

                att = config.Attributes["dbType"];
                if (att != null)
                {
                    info.DbType = att.InnerText;
                }

                att = config.Attributes["appnamespace"];
                if (att != null)
                {
                    info.AppNamespace = att.InnerText;
                }
                att = config.Attributes["assembly"];
                if (att != null)
                {
                    info.Assembly = att.InnerText;
                }
                att = config.Attributes["name"];
                if (att != null)
                {
                    info.DbName = att.InnerText;
                }

                att = config.Attributes["cache"];
                if (att != null)
                {
                    info.CacheType = att.InnerText;
                }

                att = config.Attributes["cacheConnString"];
                if (att != null)
                {
                    info.CacheConnString = att.InnerText;
                }
                att = config.Attributes["allCache"];
                if (att != null)
                {
                    info.IsAllTable = att.InnerText == "1";
                }
                return(info);
            }
            return(null);
        }
예제 #3
0
        /// <summary>
        /// 加载其他配置信息
        /// </summary>
        /// <param name="info"></param>
        private static void LoadConfig(ClassDesignerInfo cdinfo, DBConfigInfo info)
        {
            XmlDocument doc = new XmlDocument();

            try
            {
                doc.Load(GetConfigFileName(cdinfo));
                XmlNodeList lstConfig = doc.GetElementsByTagName("config");
                if (lstConfig.Count > 0)
                {
                    XmlNode      config = lstConfig[0];
                    XmlAttribute att    = att = config.Attributes["tier"];
                    if (att != null)
                    {
                        int tier = 1;
                        if (int.TryParse(att.InnerText, out tier))
                        {
                            info.Tier = Convert.ToInt32(att.InnerText);
                        }
                        else
                        {
                            info.Tier = 3;
                        }
                    }

                    att = config.Attributes["isAllDal"];
                    if (att != null)
                    {
                        info.IsAllDal = (att.InnerText == "1");
                    }
                    att = config.Attributes["entityToDirectory"];
                    if (att != null)
                    {
                        info.EntityToDirectory = (att.InnerText == "1");
                    }
                    att = config.Attributes["summary"];
                    if (att != null)
                    {
                        int summary = (int)SummaryShowItem.All;
                        if (int.TryParse(att.InnerText, out summary))
                        {
                            info.SummaryShow = (SummaryShowItem)summary;
                        }
                        else
                        {
                            info.SummaryShow = SummaryShowItem.All;
                        }
                    }
                }
            }
            catch
            {
            }
        }
예제 #4
0
        public GrneraterBase(DBEntityInfo entity, ClassDesignerInfo info)
        {
            _table              = entity.ToTableInfo();
            _className          = entity.ClassName;
            DesignerInfo        = info;
            _entityBaseTypeName = GetBaseTypeName(entity.BaseType);


            _entityBaseTypeShortName = GetBaseTypeShortName(entity.BaseType);

            _entityFileName      = entity.FileName;
            _entityNamespace     = entity.EntityNamespace;
            _baseNamespace       = GetBaseTypeNameSpace(entity.BaseType);
            _BQLEntityNamespace  = entity.EntityNamespace + ".BQLEntity";
            _businessNamespace   = entity.EntityNamespace + ".Business";
            _dataAccessNamespace = entity.EntityNamespace + ".DataAccess";
            _DBName   = entity.CurrentDBConfigInfo.DbName;
            _dbConfig = entity.CurrentDBConfigInfo;
        }
예제 #5
0
        /// <summary>
        /// 加载数据库信息
        /// </summary>
        /// <param name="curProject">当前工程</param>
        /// <param name="curDiagram">当前图</param>
        /// <returns></returns>
        public static DBConfigInfo LoadInfo(ClassDesignerInfo info)
        {
            if (info.CurrentProject == null || info.SelectDocView == null)
            {
                return(null);
            }
            string       xmlFieName = GetFileName(info);
            DBConfigInfo ret        = null;
            XmlDocument  doc        = new XmlDocument();

            try
            {
                doc.Load(xmlFieName);
                ret = LoadInfo(doc);
                LoadConfig(info, ret);
                ret.FileName = xmlFieName;
            }
            catch
            {
            }
            return(ret);
        }
예제 #6
0
        public GrneraterBase(EntityConfig entity)
        {
            //_entity = entity;
            //_tableName = entity.TableName;
            _table                   = entity.ToTableInfo();
            DesignerInfo             = entity.DesignerInfo;
            _entityBaseTypeName      = GetBaseTypeName(entity.BaseTypeName);
            _entityBaseTypeShortName = GetBaseTypeShortName(entity.BaseTypeName);
            _baseNamespace           = GetBaseTypeNameSpace(entity.BaseTypeName);
            _entityFileName          = entity.FileName;
            _entityNamespace         = entity.Namespace;
            //_summary = entity.Summary;
            _className           = entity.ClassName;
            _BQLEntityNamespace  = entity.Namespace + ".BQLEntity";
            _businessNamespace   = entity.Namespace + ".Business";
            _dataAccessNamespace = entity.Namespace + ".DataAccess";
            _DBName         = entity.CurrentDBConfigInfo.DbName;
            _dbConfig       = entity.CurrentDBConfigInfo;
            _dicGenericInfo = entity.GenericInfo;

            _lstGenericArgs = entity.GenericArgs;
        }