Within an ASP.Net MVC model binder is it possible to create an object of the bound type and then update the properties on it.
e.g.
public override object BindModel(ControllerContext controllerContext,
ModelBindingContext bindingContext)
{
ParentType boundModel = null;
if (bindingContext.ModelType == typeof(ParentType))
{
var myFactory = new MyFactory();
var someValue = bindingContext.ValueProvider.GetValue
("someFieldId").AttemptedValue;
ChildType child = myFactory.Create(someValue);
BindModel(child);
boundModel = child;
}
return boundModel;
}
In this code I want to know if there is something similar to the BindModel(child) call, kind of like TryModelUpdate() from a controller?