My current solution where I use SerializeTo/DeserializeFrom in the template extender does not work.
using System.Collections.Generic; using Dynamicweb.Content.Items.Rendering; using Dynamicweb.Rendering; public class ArticleTemplateExtender : ItemTemplateExtender { public override void ExtendTemplate(Template template) { var item = this.Item as Dynamicweb.Content.Items.Item; if (item == null || !item.SystemName.Equals("Article")) { return; } var article = new Article(); var dictionary = new Dictionary<string, object>(); this.Item.SerializeTo(dictionary); article.DeserializeFrom(dictionary); // Set tags here } }
I have a property of type IList<string>
System.InvalidCastException: Invalid cast from 'System.String' to 'System.Collections.Generic.IList`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'.
Any suggestions?
/Morten