Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Episerver Core - PropertyList class <T> - update issue

Vote:
 

On updating Episerver core to the latest version v11.13.0.0, the ParseToObject method in the PropertyList<T> class is removed. Kindly suggest an alternate for this method.

Thanks in advance.

public class PropertyListBase<T> : PropertyList<T>
{
public PropertyListBase()
{
objectSerializer = this.objectSerializerFactory.Service.GetSerializer("application/json");
}

private Injected<ObjectSerializerFactory> objectSerializerFactory;
private IObjectSerializer objectSerializer;

protected override T ParseItem(string value)
{
return objectSerializer.Deserialize<T>(value);
}

public override PropertyData ParseToObject(string value)
{
ParseToSelf(value);
return this;
}
}

#207391
Edited, Sep 18, 2019 12:52
Vote:
 

Earlier versions you needed this base class, but you no longer do. You can delete it. Now you can simply do:

[PropertyDefinitionTypePlugIn] public class LocationsProperty : PropertyList<Location> { }

You can read more details about the updated propertylist here

https://world.episerver.com/documentation/developer-guides/CMS/Content/Properties/generic-propertylist/

...and if you use it on a POCO class that has urls remember to decorate that field with to avoid serialization errors (url wont be saved correctly) 

[JsonProperty]
[JsonConverter(typeof(UrlConverter))]
[Display(Name = "Favorite", Order = 200)]
public virtual Url FavoriteLink { get; set; }
#207392
Edited, Sep 18, 2019 14:45
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.