예제 #1
0
        private string DoGenerateEntity(GenerateCodeTypeTreeNavigationItem generateCodeTypeTreeNavigationItem)
        {
            EntityClassTemplate entityClassTemplate = new EntityClassTemplate();

            entityClassTemplate.Session = new Dictionary <string, object>();
            entityClassTemplate.Session.Add("_classStructure", CreateClassStructure(generateCodeTypeTreeNavigationItem));
            entityClassTemplate.Initialize();
            return(entityClassTemplate.TransformText());
        }
예제 #2
0
        public GenerateCodeTypeTreeNavigationItem GetTypeToGenerate(Guid owningTypeId)
        {
            TreeNavigationItem        compositeTypeTreeNavigationItem         = _compositeTypeNavigationRepository.FindSpecific(owningTypeId);
            List <TreeNavigationItem> compositeTypeElementTreeNavigationItems = _compositeTypeElementNavigationRepository.FindChildren(owningTypeId);

            GenerateCodeTypeTreeNavigationItem generateCodeTypeTreeNavigationItem = new GenerateCodeTypeTreeNavigationItem();

            generateCodeTypeTreeNavigationItem.Name = compositeTypeTreeNavigationItem.Name;

            List <GenerateCodeTypeElementTreeNavigationItem> generateCodeTypeElementTreeNavigationItems = new List <GenerateCodeTypeElementTreeNavigationItem>();

            foreach (CompositeTypeElementTreeNavigationItem compositeTypeElementTreeNavigationItem in compositeTypeElementTreeNavigationItems)
            {
                generateCodeTypeTreeNavigationItem.Fields.Add(CreateGenerateCodeTypeElementTreeNavigationItem(compositeTypeElementTreeNavigationItem));
            }
            return(generateCodeTypeTreeNavigationItem);
        }
예제 #3
0
        private ClassStructure CreateClassStructure(GenerateCodeTypeTreeNavigationItem generateCodeTypeTreeNavigationItem)
        {
            ClassStructure classStructure = new ClassStructure(Modifier.PUBLIC, generateCodeTypeTreeNavigationItem.Name);

            classStructure.Namespace = generateCodeTypeTreeNavigationItem.Namespace;
            if (generateCodeTypeTreeNavigationItem.Table)
            {
                classStructure.AddAnnotation(Annotation.CreateAnnotation(Annotation.TableAnnotation, CreateColumnName(generateCodeTypeTreeNavigationItem.Name)));
            }
            if (generateCodeTypeTreeNavigationItem.DiscriminatorValue)
            {
                classStructure.AddAnnotation(Annotation.CreateAnnotation(Annotation.DiscriminatorValueAnnotation));
            }

            Dictionary <string, Settings> codeDataTypeConversionToName = GetCodeDataTypeConversionToName();

            foreach (GenerateCodeTypeElementTreeNavigationItem generatedCodeTypeElementTreeNavigationItem in generateCodeTypeTreeNavigationItem.Fields)
            {
                classStructure.Fields.Add(CreateFieldStructure(generatedCodeTypeElementTreeNavigationItem, codeDataTypeConversionToName));
            }
            return(classStructure);
        }
예제 #4
0
 public GenerateCodeTypeTreeNavigationItem Generate(GenerateCodeTypeTreeNavigationItem generateCodeTypeTreeNavigationItem)
 {
     generateCodeTypeTreeNavigationItem.DtoGenerated    = DoGenerateDto(generateCodeTypeTreeNavigationItem);
     generateCodeTypeTreeNavigationItem.EntityGenerated = DoGenerateEntity(generateCodeTypeTreeNavigationItem);
     return(generateCodeTypeTreeNavigationItem);
 }