public ComplexType Build(XElement element) { var complexType = new ComplexType(); foreach (var propertyNode in element.Elements().Where(x => x.Name.LocalName.Equals("sequence")).Elements().ToList()) { var property = new Property { Name = Helpers.PascalCase(propertyNode.Attribute("name").Value) }; var typeAttribute = propertyNode.Attribute("type"); if (typeAttribute == null) continue; property.DataType = Helpers.FormatClrType(typeAttribute.Value); property.IsCollection = !(propertyNode.Attribute("minOccurs") == null && propertyNode.Attribute("maxOccurs") == null); complexType.Properties.Add(property); } return complexType; }
private static bool IsUsingSimpleTypes(ComplexType complexType) { var isUsingSimpleTypes = false; foreach (var property in complexType.Properties) { if (!isUsingSimpleTypes) isUsingSimpleTypes = restDefinition.SimpleTypes.Any(x => x.Name.Equals(property.DataType, StringComparison.OrdinalIgnoreCase)); } return isUsingSimpleTypes; }