I started testing a \"workflow\" with EF code first.
First, I created class diagram. Designed few classes - you can see class diagram here
Then I used EF Code First, cre
I believe you'll need a ProjectManager class, and your Project entity will need to have a property that points to the ProjectManager class.
Something like:
public class Project
{
public string Description {get; set;}
public Member ProjectManager {get; set;}
}
ProjectManager
will not be loaded by default. You must either use lazy loading or eager loading. Eager loading will load ProjectManager
when you query Projects
:
public ActionResult Index()
{
using (var db = new EntsContext())
{
return View(db.Projects.Include(p => p.ProjectManager).ToList());
}
}
Lazy loading will load ProjectManager
once the property is accessed in the view. To allow lazy loading you must create all your navigation properties as virtual
but in your current scenario it isn't good appraoch because: