public StructureTree Parse() { StructureTree result = new StructureTree(); string[] lines = StringUtil.SplitLines(this.SourceText); for (int i = 0; i < lines.Length; i++) { StructureItem item = this.ParseLine(lines[i], i); if (item != null) { result.AddItem(item); } } // All lines loaded, structure items mapped, let's resolve references foreach (StructureEntity entity in result.Entities) { foreach (StructureProperty property in entity.Properties) { if ((!property.IsTyped) && (!string.IsNullOrEmpty(property.ReferenceName))) { property.ReferenceItem = this.itemMap[property.ReferenceName.ToLower()]; if (property.ReferenceItem is StructureDomain) { StructureDomain domain = property.ReferenceItem as StructureDomain; property.DataTypeStr = domain.DataTypeStr; property.DataType = domain.DataType; property.DataTypeLength = domain.DataTypeLength; property.DataTypeDecimals = domain.DataTypeDecimals; if (domain.IsIdentity) { property.IsIdentity = true; property.IsPrimaryKey = true; property.IsNullable = false; } } else { } } } } return result; }
public StructureTree Parse() { StructureTree result = new StructureTree(); string[] lines = StringUtil.SplitLines(this.SourceText); for (int i = 0; i < lines.Length; i++) { StructureItem item = this.ParseLine(lines[i], i); if (item != null) { result.AddItem(item); } } // All lines loaded, structure items mapped, let's resolve references foreach (StructureEntity entity in result.Entities) { foreach (StructureProperty property in entity.Properties) { if ((!property.IsTyped) && (!string.IsNullOrEmpty(property.ReferenceName))) { property.ReferenceItem = this.itemMap[property.ReferenceName.ToLower()]; if (property.ReferenceItem is StructureDomain) { StructureDomain domain = property.ReferenceItem as StructureDomain; property.DataTypeStr = domain.DataTypeStr; property.DataType = domain.DataType; property.DataTypeLength = domain.DataTypeLength; property.DataTypeDecimals = domain.DataTypeDecimals; if (domain.IsIdentity) { property.IsIdentity = true; property.IsPrimaryKey = true; property.IsNullable = false; } } else { } } } } return(result); }