buildingblocks/BuildingBlocks.DD4T.MarkupModels

See if we can not use IEnumerable for Multivalue properties.

Opened this issue · 0 comments

Multivalue fields must be of type IEnumerable for example:

[EmbeddedValues("slides", typeof(HomepageCarouselSlideViewModel), IsMultiValue = true)]
public IEnumerable Slides { get; set; }

This is bad because IEnumerables cannot be reliably updated so code like

foreach(var slide in model.Slides)
{
slide.SomeProp = "somevalue";
}

The value of SomeProp could not be guarenteed to be set on the next enumeration.

Current workaround is to enumerate with ToList and then set this back to the property