Example #1
0
        public static void CreateTypes(CodeNamespace codeNamespace, CodeGenerationInfo generationInfo)
        {
            codeNamespace.Comments.Add(new CodeCommentStatement($"------------------------------------------------------------------------------"));
            codeNamespace.Comments.Add(new CodeCommentStatement($"dataBase: {generationInfo.DataBaseName}"));
            codeNamespace.Comments.Add(new CodeCommentStatement($"revision: {generationInfo.Revision}"));
            codeNamespace.Comments.Add(new CodeCommentStatement($"requested revision: {generationInfo.RequestedRevision}"));
            codeNamespace.Comments.Add(new CodeCommentStatement($"hash value: {generationInfo.TypesHashValue}"));
            codeNamespace.Comments.Add(new CodeCommentStatement($"tags: {generationInfo.Tags}"));
            codeNamespace.Comments.Add(new CodeCommentStatement($"------------------------------------------------------------------------------"));

            foreach (var item in generationInfo.Types)
            {
                CreateType(codeNamespace, item, generationInfo);
            }
        }
Example #2
0
        public static void CreateTypeMember(CodeTypeDeclaration classType, TypeMemberInfo typeMemberInfo, CodeGenerationInfo generationInfo)
        {
            var cmm = new CodeMemberField
            {
                Name           = typeMemberInfo.Name,
                InitExpression = new CodePrimitiveExpression(typeMemberInfo.Value)
            };

            if (generationInfo.OmitComment == false)
            {
                cmm.Comments.AddSummary(typeMemberInfo.Comment);
            }
            if (generationInfo.OmitSignatureDate == false)
            {
                cmm.Comments.Add(CremaCodeGenerator.Creator, typeMemberInfo.CreationInfo.ID);
                cmm.Comments.Add(CremaCodeGenerator.CreatedDateTime, typeMemberInfo.CreationInfo.DateTime);
                cmm.Comments.Add(CremaCodeGenerator.Modifier, typeMemberInfo.ModificationInfo.ID);
                cmm.Comments.Add(CremaCodeGenerator.ModifiedDateTime, typeMemberInfo.ModificationInfo.DateTime);
            }

            classType.Members.Add(cmm);
        }
Example #3
0
        public static void CreateType(CodeNamespace codeNamespace, TypeInfo typeInfo, CodeGenerationInfo generationInfo)
        {
            var classType = new CodeTypeDeclaration(typeInfo.Name)
            {
                Attributes = MemberAttributes.Public,
                IsEnum     = true
            };

            if (typeInfo.IsFlag == true)
            {
                classType.CustomAttributes.Add(typeof(FlagsAttribute));
            }

            if (generationInfo.OmitComment == false)
            {
                classType.Comments.AddSummary(typeInfo.Comment);
            }

            if (generationInfo.OmitSignatureDate == false)
            {
                classType.Comments.Add(CremaCodeGenerator.Creator, typeInfo.CreationInfo.ID);
                classType.Comments.Add(CremaCodeGenerator.CreatedDateTime, typeInfo.CreationInfo.DateTime);
                classType.Comments.Add(CremaCodeGenerator.Modifier, typeInfo.ModificationInfo.ID);
                classType.Comments.Add(CremaCodeGenerator.ModifiedDateTime, typeInfo.ModificationInfo.DateTime);
            }

            foreach (var item in typeInfo.Members)
            {
                CreateTypeMember(classType, item, generationInfo);
            }

            codeNamespace.Types.Add(classType);
        }