How do I build a class that shares a table with multiple columns in MVC3?

Posted by Barrett Kuethen on Stack Overflow See other posts from Stack Overflow or by Barrett Kuethen
Published on 2012-06-06T22:36:28Z Indexed on 2012/06/06 22:40 UTC
Read the original article Hit count: 222

Filed under:
|

I have a Job table

    public class Job
{
    public int JobId { get; set; }
    public int SalesManagerId { get; set; }
    public int SalesRepId { get; set; }
}

and a Person table

    public class Person
{
    public int PersonId { get; set; }
    public int FirstName { get; set; }
    public int LastName { get; set; }
}

My question is, how do I link the SalesManagerId to the Person (or PersonId) as well as the SalesRepId to the Person (PersonId)? The Sales Manager and Sales Rep are independent of each other. I just don't want to make 2 different lists to support the Sales Manager and Sales Rep roles.

I'm new to MVC3, but it seems

public virtual Person Person {get; set; }
would be the way to go, but that doesn't work.

Any help would be appreciated!

Thanks!

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about asp.net-mvc-3