Exemplo n.º 1
0
        /// <summary>
        /// 生成实体代码
        /// </summary>
        /// <param name="project"></param>
        /// <param name="schema"></param>
        public override void CreateEntityCode(ProjectConfig project, EntityConfig schema)
        {
            IOHelper.CheckPath(schema.Parent.MobileCsPath);
            var builder = new MobileEntityCoder
            {
                Project = schema.Parent,
                Entity  = schema
            };

            builder.CreateBaseCode(schema.Parent.MobileCsPath);
            builder.CreateExtendCode(schema.Parent.MobileCsPath);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 生成实体代码
        /// </summary>
        /// <param name="project"></param>
        /// <param name="schema"></param>
        public override void CreateEntityCode(ProjectConfig project, EntityConfig schema)
        {
            GlobalConfig.CheckPath(schema.Parent.MobileCsPath);

            Message = "正在生成" + schema.Caption + "...";
            if (!schema.IsReference && !string.IsNullOrWhiteSpace(project.MobileCsPath))
            {
                var entityPath = GlobalConfig.CheckPath(project.MobileCsPath);
                var builder    = new MobileEntityCoder
                {
                    Entity  = schema,
                    Project = project
                };
                builder.CreateBaseCode(entityPath);
                builder.CreateExtendCode(entityPath);
            }
            if (!string.IsNullOrEmpty(project.CppCodePath))
            {
                var cppPath     = GlobalConfig.CheckPath(project.CppCodePath);
                var structCoder = new CppStructCoder
                {
                    Entity  = schema,
                    Project = project
                };
                structCoder.CreateBaseCode(cppPath);
                structCoder.CreateExtendCode(cppPath);
                if (!schema.NoDataBase)
                {
                    var modelCoder = new CppModelCoder
                    {
                        Entity  = schema,
                        Project = project
                    };
                    modelCoder.CreateBaseCode(cppPath);
                    modelCoder.CreateExtendCode(cppPath);
                    if (!schema.IsReference)
                    {
                        var accessCoder = new CppAccessCoder
                        {
                            Entity  = schema,
                            Project = project
                        };
                        accessCoder.CreateBaseCode(cppPath);
                        accessCoder.CreateExtendCode(cppPath);
                    }
                }
            }

            Message = schema.Caption + "已完成";
        }