Exemplo n.º 1
0
        /// <summary>
        /// 生成控制器
        /// </summary>
        /// <param name="metadata"></param>
        /// <returns></returns>
        public CodeData GenerateController(ProjectMetadata metadata)
        {
            var template = GetTemplateCode(metadata, CodeType.Controller);
            var code     = new CodeData()
            {
                SourceCode = template,
                FileName   = $"{metadata.EntityMetadata.EntityName}Controller.cs"
            };

            return(code);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 创建分页Dto代码
        /// </summary>
        /// <param name="metadata"></param>
        /// <returns></returns>
        public CodeData GeneratePageDtoCode(ProjectMetadata metadata)
        {
            var template = GetTemplateCode(metadata, CodeType.PageListDto);
            var code     = new CodeData()
            {
                SourceCode = template,
                FileName   = $"Dtos/{metadata.EntityMetadata.EntityName}PageListDto.cs"
            };

            return(code);
        }
Exemplo n.º 3
0
        public CodeData GenerateServiceImpl(ProjectMetadata metadata)
        {
            var template = GetTemplateCode(metadata, CodeType.ServiceImpl);
            var code     = new CodeData()
            {
                SourceCode = template,
                FileName   = $"Services/{metadata.EntityMetadata.EntityName}Service.cs"
            };

            return(code);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 生成实体配置代码
        /// </summary>
        /// <param name="metadata">元数据</param>
        /// <returns></returns>
        public CodeData GenerateEntityConfigurationCode(ProjectMetadata metadata)
        {
            var template = GetTemplateCode(metadata, CodeType.EntityConfiguration);
            var code     = new CodeData()
            {
                SourceCode = template,
                FileName   = $"EntityConfigurations/{metadata.EntityMetadata.EntityName}Configuration.cs"
            };

            return(code);
        }