コード例 #1
0
        /// <summary>
        /// 保存配置信息
        /// </summary>
        private void SaveConfigInfo(string path)
        {
            XmlDocument doc        = EntityMappingConfig.NewXmlDocument();
            XmlNode     configNode = doc.CreateElement("config");

            doc.AppendChild(configNode);

            XmlAttribute att = doc.CreateAttribute("tier");

            att.InnerText = this.Tier.ToString();
            configNode.Attributes.Append(att);

            att           = doc.CreateAttribute("isAllDal");
            att.InnerText = this.IsAllDal ? "1" : "0";
            configNode.Attributes.Append(att);

            att           = doc.CreateAttribute("summary");
            att.InnerText = ((int)this.SummaryShow).ToString();
            configNode.Attributes.Append(att);

            att           = doc.CreateAttribute("entityToDirectory");
            att.InnerText = this.EntityToDirectory ? "1" : "0";
            configNode.Attributes.Append(att);

            int    last     = path.LastIndexOf(".xml");
            string savePath = path;

            if (last > 0)
            {
                savePath  = path.Substring(0, last);
                savePath += ".config.xml";
            }
            EntityMappingConfig.SaveXML(savePath, doc);
        }
コード例 #2
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="path"></param>
        public void SaveConfig(string path)
        {
            XmlDocument doc        = EntityMappingConfig.NewXmlDocument();
            XmlNode     configNode = doc.CreateElement("config");

            doc.AppendChild(configNode);

            XmlAttribute att = doc.CreateAttribute("connectionString");

            att.InnerText = this.ConnectionString;
            configNode.Attributes.Append(att);

            att           = doc.CreateAttribute("dbType");
            att.InnerText = this.DbType;
            configNode.Attributes.Append(att);

            att           = doc.CreateAttribute("appnamespace");
            att.InnerText = this.AppNamespace;
            configNode.Attributes.Append(att);

            att           = doc.CreateAttribute("assembly");
            att.InnerText = this.Assembly;
            configNode.Attributes.Append(att);

            att           = doc.CreateAttribute("name");
            att.InnerText = this.DbName;
            configNode.Attributes.Append(att);

            att           = doc.CreateAttribute("cache");
            att.InnerText = this.CacheType;
            configNode.Attributes.Append(att);

            att           = doc.CreateAttribute("cacheConnString");
            att.InnerText = this.CacheConnString;
            configNode.Attributes.Append(att);

            att           = doc.CreateAttribute("allCache");
            att.InnerText = this.IsAllTable ? "1" : "0";
            configNode.Attributes.Append(att);

            att           = doc.CreateAttribute("lazy");
            att.InnerText = ((int)this.AllowLazy).ToString();
            configNode.Attributes.Append(att);

            EntityMappingConfig.SaveXML(path, doc);
            SaveConfigInfo(path);
        }
コード例 #3
0
        /// <summary>
        /// 生成扩展代码
        /// </summary>
        private void GenerateExtenCode()
        {
            BQLEntityGenerater bqlEntity = new BQLEntityGenerater(this);

            GenerateExtendCode();
            if (_currentDBConfigInfo.Tier == 3)
            {
                Generate3Tier g3t = new Generate3Tier(this);
                g3t.GenerateBusiness();
                if (!string.IsNullOrEmpty(this.TableName))
                {
                    g3t.GenerateIDataAccess();
                    g3t.GenerateDataAccess();
                    g3t.GenerateBQLDataAccess();
                }
            }
            bqlEntity.GenerateBQLEntityDB();
            bqlEntity.GenerateBQLEntity();
            EntityMappingConfig.SaveXML(this);
        }
コード例 #4
0
 /// <summary>
 /// 保存XML信息
 /// </summary>
 /// <param name="entity"></param>
 public void SaveXML()
 {
     EntityMappingConfig.SaveXML(_fileName, _doc);
     EnvDTE.ProjectItem newit = DesignerInfo.CurrentProject.ProjectItems.AddFromFile(_fileName);
     newit.Properties.Item("BuildAction").Value = (int)BuildAction.Resource;
 }