选项1
您可以从KitchenVM的自定义活页夹继承HouseVM的模型活页夹。这将允许厨房VM(或相关)属性的绑定仍然由该绑定器绑定。比如:
public class HouseViewModelBinder : KitchenViewModelBinder
{
protected override void BindProperty( ControllerContext controllerContext, ModelBindingContext bindingContext, System.ComponentModel.PropertyDescriptor propertyDescriptor )
{
if (propertyDescriptor.PropertyType == typeof(KitchenVM))
{
base.BindProperty(controllerContext, bindingContext, propertyDescriptor);
}
// bind the other properties here
}
}
选项2
This post by Jimmy Bogard