I want to have a list of stands (at the exhibition) and a list of exhibitors.
The list of stands is separate from the list of exhibitors, but after registration I want the exhibitor to be able to book a stand.
When they select / order a stand, I would like to be able to have a list of stands in my opinion, as well as show the associated exhibitor who ordered it.
Similarly, I would like to list in a different form the participants, as well as the stand they booked.
So, I'm trying to establish a one-to-one relationship (using EF CodeFirst).
However, when I try to add a controller for the stand or exhibitor, I get the following error:

My models:
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; } }
I am sure that this is due to the "virtual" part of the models.
Can someone please indicate what needs to be updated in order to allow the connection?
Thanks,
Mark
source share