这是适用于 MVC 1 和 2 的一般模型绑定问题。我想知道 MVC2 是否会更好,但这是我的问题:
我有一个相当复杂的模型:
public interface IEvent
public int Id
public string Title
public List<EventContact> Contacts
public List<EventDatesLocations> DatesLocations
public class EventDatesLocations
public int Id
public DateTime StartDate
public DateTime EndDate
public List<EventLocation> Locations
我的 IEvent 类有一个自定义模型绑定器,它基本上完成了 IEvent 的所有绑定。我调用默认模型绑定器来绑定Contacts
列表,效果很好。
我准备开始尝试绑定这些DatesLocations
东西,但我想确保我做的事情正确。
总的来说,我不确定我是否了解模型绑定的所有细节。为其中的列表设置多个模型绑定器会更好,IEvent
还是只有一个IEvent
模型绑定器(就像我现在正在做的那样)调用它需要的列表的默认绑定器。
专家是怎么做的?:P