/// <summary> /// If no customization files are defined, add an empty read/write property. /// </summary> /// <remarks> /// Beware that with this configuration code may not compile because of the /// warnings about the properties not returning any value. /// </remarks> private void AddProperty(BaseLeafSchemaElement element, Type type) { ArrayList nodes = Retriever.RetrieveCustomization(element); if (nodes.Count != 0) { // Original type name is the current type name without the // type naming convention appended during tree parsing. string name = (Configuration.TypeNaming != String.Empty) ? CurrentType.Name.Replace(Configuration.TypeNaming, "") : CurrentType.Name; CodeMemberProperty prop = CodeDomHelper.BuildProperty( name, element.Name, Configuration.TypeNaming, Configuration.CollectionNaming, type, nodes, CurrentNamespace); XmlAttribute[] attributes = ((XmlSchemaAnnotated)element.SchemaObject).UnhandledAttributes; if (attributes != null) { foreach (XmlAttribute attr in attributes) { prop.UserData.Add(attr.LocalName, attr); } } CurrentType.Members.Add(prop); } else if (Retriever.Files.Count == 0) { CodeMemberProperty prop = new CodeMemberProperty(); prop.Attributes = MemberAttributes.Public; prop.Name = element.Name; prop.Type = new CodeTypeReference(type); prop.HasGet = true; prop.HasSet = true; CurrentType.Members.Add(prop); } }