ExternalizedPropertyDescriptor EnsureXmlSerializable(ExternalizedPropertyDescriptor descriptor)
        {
            if (descriptor == null)
            {
                return(null);
            }
            var xmlIgnore = descriptor.Attributes[typeof(XmlIgnoreAttribute)];

            if (xmlIgnore != null)
            {
                var converted = true;
                var serializableDescriptor = descriptor.Convert(externalizedProperty =>
                {
                    var proxyDescriptor = (from property in TypeDescriptor.GetProperties(externalizedProperty.ComponentType).Cast <PropertyDescriptor>()
                                           let xmlElement = (XmlElementAttribute)property.Attributes[typeof(XmlElementAttribute)]
                                                            where xmlElement != null && xmlElement.ElementName == externalizedProperty.Name
                                                            select property)
                                          .FirstOrDefault();
                    converted &= proxyDescriptor != null;
                    return(proxyDescriptor);
                });
                return(converted ? serializableDescriptor : null);
            }

            return(descriptor);
        }
Beispiel #2
0
 private ExternalizedPropertyDescriptor(ExternalizedPropertyDescriptor descr, PropertyDescriptor[] descriptors)
     : base(descr.Name, null)
 {
     instances   = descr.instances;
     properties  = descriptors;
     description = descr.description;
     category    = descr.category;
     isReadOnly  = descr.isReadOnly;
 }
Beispiel #3
0
 public ExternalizedAttributeCollection(ExternalizedPropertyDescriptor owner)
     : base(null)
 {
     this.owner = owner;
 }