public PropertyInfoGenerator( ContentTypeConfiguration config, IList<DataTypeDefinition> dataTypes, params CodeGeneratorBase[] memberGenerators ) : base(config, dataTypes, memberGenerators) { }
public CompositeCodeGenerator( ContentTypeConfiguration config, params CodeGeneratorBase[] generators ) : base(config) { this.generators = generators; }
public PropertiesParser( ContentTypeConfiguration configuration, ContentTypeCodeParserBase propertyParser ) : base(configuration) { this.propertyParser = propertyParser; }
public NamespaceGenerator( ContentTypeConfiguration config, params CodeGeneratorBase[] memberGenerators ) : base(config) { this.memberGenerators = memberGenerators; }
private void WriteDocuments( ContentTypeConfiguration contentTypeConfiguration, IEnumerable<XDocument> documents, string path, string baseClass ) { var contentTypeName = contentTypeConfiguration.ContentTypeName; var docsAtLevel = documents.Where(doc => doc.Element(contentTypeName).Element("Info").Element("Master").Value == baseClass); foreach (var doc in docsAtLevel) { var alias = doc.Element(contentTypeName).Element("Info").Element("Alias").Value; var directoryPath = Path.Combine(path, alias); if (!Directory.Exists(directoryPath)) Directory.CreateDirectory(directoryPath); var defPath = Path.Combine(directoryPath, "def.config"); if (configuration.OverwriteReadOnly && File.Exists(defPath)) File.SetAttributes(defPath, File.GetAttributes(defPath) & ~FileAttributes.ReadOnly); doc.Save(defPath); WriteDocuments(contentTypeConfiguration, documents, directoryPath, alias); } }
public ClassGenerator( ContentTypeConfiguration config, params CodeGeneratorBase[] memberGenerators ) : base(config, memberGenerators) { }
public PropertyInfoGenerator( ContentTypeConfiguration config, IList<DataTypeDefinition> dataTypes ) : base(config) { this.dataTypes = dataTypes; }
public PropertiesGenerator( ContentTypeConfiguration config, params CodeGeneratorBase[] propertyGenerators ) : base(config) { this.propertyGenerators = propertyGenerators; }
protected ContentTypeCodeParser( ContentTypeConfiguration configuration, params ContentTypeCodeParserBase[] memberParsers ) : base(configuration) { this.memberParsers = memberParsers; }
public void Create_DelegatesConfiguration() { var factory = new DefaultParserFactory(); var configuration = new ContentTypeConfiguration(CodeGeneratorConfiguration.Create(), "DocumentType"); var dataTypeDefinitions = new List<DataTypeDefinition>(); var parser = factory.Create(configuration, dataTypeDefinitions); Assert.IsInstanceOf<DocumentTypeCodeParser>(parser); }
public CodeGeneratorBase CreateDocTypeGenerator(ContentTypeConfiguration configuration, IEnumerable<DataTypeDefinition> dataTypes) { return CreateGenerators( configuration, dataTypes, "DocumentType", new DocumentTypeInfoGenerator(configuration) ); }
public AttributeCodeGenerator( string attributeName, ContentTypeConfiguration config, params CodeGeneratorBase[] memberGenerators ) : base(config) { this.attributeName = attributeName; this.memberGenerators = memberGenerators; }
public CodeGeneratorBase CreateMediaTypeGenerator(ContentTypeConfiguration configuration, IEnumerable<DataTypeDefinition> dataTypes) { return CreateGenerators( configuration, dataTypes, "MediaType", new CommonInfoGenerator(configuration) ); }
protected PropertyDeclarationGenerator( ContentTypeConfiguration config, IList<DataTypeDefinition> dataTypes, params CodeGeneratorBase[] memberGenerators ) : base(config) { this.DataTypes = dataTypes; this.MemberGenerators = memberGenerators; }
public DocumentTypeCodeParser( ContentTypeConfiguration configuration, params ContentTypeCodeParserBase[] memberParsers ) : base( configuration, memberParsers ) { }
private void SetConfig(ContentTypeConfiguration value, string contentTypeName) { value.config = this; value.ContentTypeName = contentTypeName; if (!Configs.ContainsKey(contentTypeName)) Configs.Add(contentTypeName, value); else Configs[contentTypeName] = value; }
public ClassGenerator( ContentTypeConfiguration config, CodeGeneratorBase entityDescriptionGenerator, params CodeGeneratorBase[] memberGenerators ) : base(config) { this.entityDescriptionGenerator = entityDescriptionGenerator; this.memberGenerators = memberGenerators; }
public ContentTypeCodeParser Create( ContentTypeConfiguration configuration, IEnumerable<DataTypeDefinition> dataTypes ) { Configuration = configuration; DataTypes = dataTypes as List<DataTypeDefinition> ?? dataTypes.ToList(); var typedParser = configuration.ContentTypeName == "DocumentType" ? CreateDocumentTypeParser() : CreateMediaTypeParser(); return typedParser; }
private void SetConfig(ContentTypeConfiguration value, string contentTypeName) { value.config = this; value.ContentTypeName = contentTypeName; if (!Configs.ContainsKey(contentTypeName)) { Configs.Add(contentTypeName, value); } else { Configs[contentTypeName] = value; } }
private CodeGeneratorBase CreateGenerators(ContentTypeConfiguration c, CodeGeneratorBase infoGenerator, IEnumerable<DataTypeDefinition> dataTypes) { return new NamespaceGenerator(c, new ImportsGenerator(c), new ClassGenerator(c, new EntityDescriptionGenerator(c), infoGenerator, new StructureGenerator(c), new PropertiesGenerator(c, new PropertyDeclarationGenerator(c, dataTypes.ToList(), new EntityDescriptionGenerator(c)), new PropertyBodyGenerator(c) ) ) ); }
public CodeGeneratorBase CreateInterfaceGenerator(ContentTypeConfiguration configuration, IEnumerable<DataTypeDefinition> dataTypes) { return new NamespaceGenerator( configuration, new ImportsGenerator(configuration), new InterfaceGenerator(configuration, new CompositeCodeGenerator( configuration, new InterfaceNameGenerator(configuration) ), new PropertiesGenerator( configuration, new InterfacePropertyDeclarationGenerator( configuration, dataTypes.ToList(), new EntityNameGenerator(configuration), new InterfacePropertyBodyGenerator(configuration) ) ) ) ); }
private static CodeGeneratorBase CreateGenerators( ContentTypeConfiguration configuration, IEnumerable<DataTypeDefinition> dataTypes, string attributeName, CodeGeneratorBase infoGenerator) { return new NamespaceGenerator( configuration, new ImportsGenerator(configuration), new ClassGenerator(configuration, new CompositeCodeGenerator( configuration, new EntityNameGenerator(configuration), new AttributeCodeGenerator( attributeName, configuration, infoGenerator, new StructureGenerator(configuration) ) ), new CtorGenerator(configuration), new PropertiesGenerator( configuration, new PublicPropertyDeclarationGenerator( configuration, dataTypes.ToList(), new EntityNameGenerator(configuration), new AttributeCodeGenerator( "GenericProperty", configuration, new PropertyInfoGenerator(configuration, dataTypes.ToList()) ), new PropertyBodyGenerator(configuration) ) ) ) ); }
private void GenerateXml(ContentTypeConfiguration contentTypeConfiguration) { var parser = new CodeParser(contentTypeConfiguration, dataTypes, new DefaultParserFactory()); var modelPath = HttpContext.Current.Server.MapPath(contentTypeConfiguration.ModelPath); if (!Directory.Exists(modelPath)) Directory.CreateDirectory(modelPath); var files = Directory.GetFiles(modelPath, "*.cs"); var documents = new List<XDocument>(); foreach(var file in files) { using (var reader = File.OpenText(file)) { var contentType = parser.Parse(reader).FirstOrDefault(); if (contentType != null) documents.Add(XDocument.Parse(serializer.Serialize(contentType))); } } var documentTypeRoot = Path.Combine(uSyncConfiguration.USyncFolder, contentTypeConfiguration.ContentTypeName); if (!Directory.Exists(documentTypeRoot)) Directory.CreateDirectory(documentTypeRoot); WriteDocuments(contentTypeConfiguration, documents, documentTypeRoot, ""); }
public EntityDescriptionGenerator(ContentTypeConfiguration config) : base(config) { }
public StructureParser(ContentTypeConfiguration configuration) : base(configuration) { }
public DocumentTypeInfoParser(ContentTypeConfiguration configuration) : base(configuration) { }
public InterfacePropertyBodyGenerator(ContentTypeConfiguration config) : base(config) { }
public ImportsGenerator(ContentTypeConfiguration config) : base(config) { }
public PropertyParser(ContentTypeConfiguration configuration, IEnumerable<DataTypeDefinition> dataTypes) : base(configuration) { this.DataTypes = dataTypes; DefaultDataType = FindDataTypeDefinition(configuration.TypeMappings.DefaultDefinitionId); }
private string EnsureModelPath(ContentTypeConfiguration typeConfig) { var modelPath = paths[typeConfig.ContentTypeName]; if (!Directory.Exists(modelPath)) Directory.CreateDirectory(modelPath); return modelPath; }
public CommonInfoGenerator(ContentTypeConfiguration config) : base(config) { }