Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

Map to Nested List Object in ViewModel

$
0
0

I have a complex JSON object with nested lists and nesteded values. Traditionally in a MVC environment I can use List Model binding which allows me to map to a list nested within the object. Below is an example of how it would be done in traditional MVC within a single Model file.

public class StudentRush : PageData
{
public virtual ContentArea Form { get; set; }
public virtual ContentArea FormSubmit { get; set; }
public virtual List<ElectronicAddress> ElectronicAddresses { get; set; }
}

public class ElectronicAddress
{
public virtual string Address { get; set; }
public virtual object Id{ get; set; }
public virtual bool IsFromAffiliation { get; set; }
}

When I try this in Episerver I get the error Type...could not be mapped to a PropertyDefinitionType. This is the case even when I use IList. Does anyone know how I can achieve model binding without straying too much away from the traditional method?

Thanks


Viewing all articles
Browse latest Browse all 9076

Trending Articles