Пример #1
0
        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;
        }
Пример #2
0
 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;
 }