public List <XElement> SerializeProperties(ModelXmlDataType dataType)
 {
     return(this.GetType().GetProperties()
            .Where(p => p.CanWrite)
            .Where(p => p.GetValue(this) != null)
            .Where(p => !String.IsNullOrWhiteSpace(p.GetValue(this).ToString()))
            .Where(p => p.GetCustomAttribute <PleskXmlDataTypeAttribute>().DataType == dataType)
            .Select(p =>
                    new XElement(p.GetCustomAttribute <PleskXmlLabelAttribute>().Label, ValueToXmlObject(p.GetValue(this)))
                    )
            .ToList());
 }
 public PleskXmlable DeserializeProperties(List <XElement> xml, ModelXmlDataType dataType)
 {
     foreach (var property in this.GetType().GetProperties()
              .Where(p => p.CanWrite)
              .Where(p => p.GetCustomAttributes <PleskXmlDataTypeAttribute>().Any(a => a.DataType == dataType))
              .Where(p => xml.Any(x => x.Name == p.GetCustomAttribute <PleskXmlLabelAttribute>().Label)))
     {
         var val = xml.FirstOrDefault(e => e.Name == property.GetCustomAttribute <PleskXmlLabelAttribute>().Label)?.Value;
         property.SetValue(this, XmlObjectToValue(val, property.PropertyType));
     }
     return(this);
 }
 public List <XElement> ToXml(ModelXmlDataType dataType)
 {
     return(SerializeProperties(dataType));
 }
 public PleskXmlDataTypeAttribute(ModelXmlDataType dataType)
 {
     DataType = dataType;
 }