The main purpose that I use anonymous class is to pass data containing various values outside the main model to view without having to create a separate viewmodel.
I found myself very comfortable with LINQ and ExpandoObject. However, since I marked the view with @model IEnumerable, I was no longer able to use Html Helper because its methods should be resolved as extension methods, which was not allowed and should throw a Runtime Exception.
@Html.Display("Property")
The problem is that I have properties needing rendering as TextBox etc. for editing thus making it almost compulsory for me to make use of Html Helper methods like EditorFor(). Therefore, I think I might as well return to strongly typed models.
However, I really don't want to mess my project up with countless "temporary" viewmodels which are just a mixture of existing models. So is there any way to accomplish that? I'm wondering if there is any better solution than a composite class.