I have two simple classes generated by code first.
public class Company
{
public int Id { get; set; }
public string Name { get; set; }
public virtual Address Address { get; set; }
}
public class Address
{
public int Id { get; set; }
public string Country { get; set; }
...
}
After saving Company in database I have Company (Id = 1 | name = "blah" | AddressId = 1) and its Address (Id = 1, Country = "Poland"). When I'm trying to load from my DbContext:
Company company = context.Companies.Find(id);
I get company with null Address property. What am I doing wrong?
(I'm using CTP5.)