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()); }
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); }
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); }
public GenerateCodeTypeTreeNavigationItem Generate(GenerateCodeTypeTreeNavigationItem generateCodeTypeTreeNavigationItem) { generateCodeTypeTreeNavigationItem.DtoGenerated = DoGenerateDto(generateCodeTypeTreeNavigationItem); generateCodeTypeTreeNavigationItem.EntityGenerated = DoGenerateEntity(generateCodeTypeTreeNavigationItem); return(generateCodeTypeTreeNavigationItem); }