2012-11-06 10:47:14 -01:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Xml;
|
|
|
|
|
|
using System.Xml.Linq;
|
2013-01-22 08:44:06 -01:00
|
|
|
|
using Umbraco.Core.Configuration;
|
2013-05-27 21:32:37 -10:00
|
|
|
|
using Umbraco.Core.PropertyEditors;
|
2013-08-07 10:34:51 +10:00
|
|
|
|
using Umbraco.Core.Services;
|
|
|
|
|
|
using umbraco.interfaces;
|
2012-11-06 10:47:14 -01:00
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Core.Models
|
|
|
|
|
|
{
|
|
|
|
|
|
public static class PropertyExtensions
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Creates the xml representation for the <see cref="Property"/> object
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="property"><see cref="Property"/> to generate xml for</param>
|
|
|
|
|
|
/// <returns>Xml of the property and its value</returns>
|
|
|
|
|
|
public static XElement ToXml(this Property property)
|
|
|
|
|
|
{
|
2014-04-28 17:28:40 +10:00
|
|
|
|
var xmlSerializer = new EntityXmlSerializer();
|
|
|
|
|
|
return xmlSerializer.Serialize(ApplicationContext.Current.Services.DataTypeService, property);
|
2012-11-06 10:47:14 -01:00
|
|
|
|
}
|
2014-04-28 17:28:40 +10:00
|
|
|
|
|
2012-11-06 10:47:14 -01:00
|
|
|
|
}
|
|
|
|
|
|
}
|