How to render the properties of the view model's base class first when using ViewData.ModelMetadata.
- by Martin R-L
When I use the ViewData.ModelMetadata.Properties in order to loop the properties (with an additional Where(modelMetadata => modelMetadata.ShowForEdit && !ViewData.TemplateInfo.Visited(modelMetadata))), and thereby create a generic edit view, the properties of the view model's base class are rendered last.
Is it possible to use a clever OrderBy() or is there another way to first get the properties of the base class, and then the sub class'?
Reverse won't do the trick since the ordering of each class' properties is perfectly fine.
A workaround would of course be composition + delegation, but since we don't have mixins, it's too un-DRY IMHO, why I seek a better solution if possible.