I have a very small object graph that I’m using:
public struct Address
{
public string AddressLine1 { get; set; }
public string AddressLine2 { get; set; }
etc...
}
public class User
{
public Address HomeAddress { get; set; }
public Address WorkAddress { get; set; }
public string FirstName { get; set; }
etc...
}
Using Entity Framework 4.1, how would I map this structure to one table so that they’re mapped to columns like:
HomeAddressLine1
HomeAddressLine2
WorkAddressLine1
WorkAddressLine2
FirstName
LastName
etc...
EF doesn’t support structures. You must use class for your Address and map it as complex type: