EntityFramework LEFT OUTER JOIN в CodeFirst
Создаю для обучения и понятие Entity Framework, тестовое приложение.
Выбрал как все советают, CodeFirst.
Прочитал про one-to-one relationship, one-to-many и тд, на этом примере (one-to-one):
public class Student
{
public int StudentId { get; set; }
public string StudentName { get; set; }
public virtual StudentAddress Address { get; set; }
}
public class StudentAddress
{
public int StudentAddressId { get; set; }
public string Address1 { get; set; }
public string Address2 { get; set; }
public string City { get; set; }
public int Zipcode { get; set; }
public string State { get; set; }
public string Country { get; set; }
public virtual Student Student { get; set; }
}
Первое, что мне не понятно, какой столбец указывает на какой.
Второе, хотелось бы понять, как такой SQL запрос, перевести в EntityFramework CodeFirst:
SELECT
dbo.Table1.Group
, dbo.Table1.Number
, dbo.Table1.Start
, dbo.Table1.Prio
, dbo.Table1.Comment
, dbo.Table2.FloatNumber
FROM
dbo.Table1
LEFT OUTER JOIN
dbo.Table2
ON
dbo.Table1.Number = dbo.Table2.Number