public static XElement SerializeReport(ReportConfig report)
 {
     return(new XElement("ReportConfig",
                         new XAttribute("Guid", report.Guid),
                         new XAttribute("Name", report.Name),
                         new XAttribute("Description", report.Description),
                         new XAttribute("Type", report.Type),
                         new XElement("Columns", report.Columns.Select(SerializeReportColumn))));
 }
        public static ReportConfig DeserializeReport(XElement element)
        {
            ReportConfig report = new ReportConfig
            {
                Guid        = Guid.NewGuid(),
                Name        = (string)element.Attribute("Name"),
                Description = (string)element.Attribute("Description"),
                Type        = EnumHelper <ReportType> .Parse((string)element.Attribute("Type")),
            };

            report.Columns.AddRange(element.Elements("Columns").Elements().Select(DeserializeReportColumn));

            return(report);
        }
 public static ReportConfig Clone(ReportConfig report)
 {
     return(DeserializeReport(SerializeReport(report)));
 }