Exemplo n.º 1
0
 internal static void Add(List <PropertyUpdateXML> updates, ProviderPropertyDefinition pdef, object value, PropertyUpdateOperation op)
 {
     updates.Add(new PropertyUpdateXML
     {
         Operation = op,
         Property  = PropertyXML.Create(pdef, value)
     });
 }
        internal static ConfigurableObjectXML Create(ConfigurableObject obj)
        {
            if (obj == null)
            {
                return(null);
            }
            ConfigurableObjectXML configurableObjectXML = new ConfigurableObjectXML();

            configurableObjectXML.ClassName = obj.GetType().Name;
            foreach (PropertyDefinition propertyDefinition in obj.ObjectSchema.AllProperties)
            {
                ProviderPropertyDefinition providerPropertyDefinition = propertyDefinition as ProviderPropertyDefinition;
                if (providerPropertyDefinition != null && !ConfigurableObjectXML.PropertiesNotToSerialize.ContainsKey(propertyDefinition))
                {
                    object      value       = obj[providerPropertyDefinition];
                    PropertyXML propertyXML = PropertyXML.Create(providerPropertyDefinition, value);
                    if (propertyXML != null)
                    {
                        configurableObjectXML.properties[providerPropertyDefinition.Name] = propertyXML;
                    }
                }
            }
            return(configurableObjectXML);
        }