Пример #1
0
        /// <summary>
        /// 固定模板的抽象类构造函数
        /// </summary>
        /// <param name="consType">创建类别</param>
        public CodeManageBase(ConstructType consType)
        {
            IsStaticModel = false;
            ModelEntity   = null;
            Construct     = consType;
            StringBuilder result = new StringBuilder();

            using (StreamReader reader = new StreamReader(string.Format("{0}.sem", consType.ToString()).GetFileResource("Code")))
            {
                while (reader.Peek() != -1)
                {
                    string temp = reader.ReadLine();
                    temp = ModelContainer.Replace(temp);
                    result.AppendLine(temp);
                }
            }
            CodeContent = result.ToString();
        }
Пример #2
0
        /// <summary>
        /// 活动模板的抽象类构造函数
        /// </summary>
        /// <param name="consType">创建类别</param>
        /// <param name="entity">活动模板的实体信息</param>
        public CodeManageBase(ConstructType consType, TemplateEntity entity)
        {
            IsStaticModel = true;
            ModelEntity   = entity;
            Construct     = consType;
            StringBuilder result = new StringBuilder();

            ModelContainer.Regist("$Data2Obj$", entity.Data2Obj, "实体的数据库名称");
            ModelContainer.Regist("$Entity$", entity.Entity, "实体的应用名称");
            using (StreamReader reader = new StreamReader(string.Format("{0}.slm", consType.ToString()).GetFileResource("Code")))
            {
                while (reader.Peek() != -1)
                {
                    string temp = reader.ReadLine();
                    temp = ModelContainer.Replace(temp);
                    result.AppendLine(temp);
                }
            }
            CodeContent = result.ToString();
        }