public override EPiServer.Core.PropertyDataType Type
{
get
{
// TODO: Write code that returns the PropertyDataType this property is based on.
}
}
When I'm creating a custom property it seems that I must provide the base property type, which is an enumeration of the existing property types in Episerver. But the reason I'm deriving from EPiServer.Core.PropertyData is that I want to create completely new property type not derived from the existing ones. Where is the pint? Am I missing somthing?
Nikolay Raychev
ProPeople
Hi,
I just wanted to add that i've managed to store a seializable class in a LongString property. Just in case anyone wondered if it would work :)
My code:
[Serializable]
Public class yourObject
{
..
}
Functions to store and collect data:
public static string SerializeUsersForPage(List<yourObject> objectList)
{
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
XmlSerializer seri = new XmlSerializer(typeof(List< yourObject >));
seri.Serialize(sw, objectList);
sw.Close();
return sw.ToString() ?? string.Empty;
}
public static List< yourObject > GetUsersForPage(PageData page)
{
if (page["yourPropName"] == null)return new List< yourObject >();
string sb = page["yourPropName "] as string;
if (string.IsNullOrEmpty(sb)) return new List< yourObject >();
XmlSerializer s = new XmlSerializer( typeof(List< yourObject >) );
List< yourObject > objectList = (List< yourObject >)s.Deserialize(new StringReader(sb));
return objectList ?? new List< yourObject >();
}