【发布时间】:2012-08-25 13:36:24
【问题描述】:
我想要一份展位清单(在贸易展览会上)和参展商清单。
展位列表与参展商列表分开 - 但是,一旦注册,我希望参展商能够预订展位。
当他们选择/预订展位时 - 我希望能够在我的视图中列出展位,并显示已预订的相关参展商。
同样,我想在另一个视图中列出参展商,以及他们预订的展位。
所以我正在尝试建立一对一的关系(使用 EF CodeFirst)。
但是,当尝试为展台或参展商添加控制器时,我收到以下错误:
我的模型是:
public class Stand
{
public int StandID { get; set; }
public string Description { get; set; }
public bool Booked { get; set; }
public int ExhibitorID { get; set; }
public virtual Exhibitor Exhibitor { get; set; }
}
public class Exhibitor
{
public int ExhibitorID { get; set; }
public string Company { get; set; }
public int StandID { get; set; }
public virtual Stand Stand { get; set; }
}
我确定这与模型的“虚拟”部分有关。
谁能帮忙指出应该更新什么,以允许连接?
谢谢,
标记
【问题讨论】:
标签: asp.net asp.net-mvc asp.net-mvc-3 entity-framework model