Agreed. We ran into this as well because some of the input had commas,
so the comma-separated string that was coming back would not work.
Another similar issue I've run into deals with render partials. For
example, if we have:
public class SomeInputViewModel : ViewModel
{
public string MemberOne { get; set; }
public string MemberTwo { get; set; }
public SomeDisplayModel { get; set; }
}
public class SomeDisplayModel
{
public string DisplayModelMember { get; set; }
}
we have two options for using with a form. The first is doing
something like
<%= this.RenderPartial().Using<SomeUserControl>().For(c =>
c.SomeDisplayModel.DisplayModelMemeber) %>
which give the form element a name of
"SomeDisplayModelDisplayModelMember". However, when this comes back
from the form, Fubu doesn't know where this goes since
SomeInputViewModel does not have a member with that name.
The second option is to create a separate user control that takes
SomeDisplayModel. However, whenever this gets output, the form element
has name="DisplayModelMember", and then we have the same problem of
not being able to map DisplayModelMember to SomeInputViewModel since
that property doesn't exist either.
That leaves the only real option to be using only primitives for
ViewModels that expect input, but this either creates a lot of
duplicate code or more levels of inheritance.
In my mind, FubuMVC should output names for objects like
name="SomeDisplayModel[DisplayModelMember]". Then we would be able to
map input back to actual objects.
What do you guys think?