I'm making an application using EF on a legacy database. In the database there are two tables I am concerned with. The structure (in C# form) looks like this:
public class Employee
{
public int employeeID {get; set;} //primary key
public string name {get; set;}
...//other attributes from this table (not relevant)
}
public class EmployeeProfile
{
public int profileID {get; set;} //primary key
public int employeeID {get; set;}
public string favoritemovie {get; set;}
...//other attributes from this table (not relevant)
}
There is a 1 - 1 relationship with EmployeeProfile
and Employee
in the database. In my application, I'm wanting to create a combined entity, like this:
public class Employee
{
public int employeeID {get; set;}
public string name {get; set;} //taken from Employee Table
public string favoritemovie { get; set; } //taken from EmployeeProfile table
}
How can I do this? I've heard of entity splitting but that requires the tables to have the same primary key.