I have the following classes:
public class Customer
{
public int CustomerId { get; private set; }
public string Name { get; private set; }
public Address MailingAddress { get; private set; }
public Address BillingAddress { get; private set; }
public Address InvoiceAddress { get; private set; }
}
public class Address //this is a Value Object, with no Id
{
public int CityID { get; private set; }
public string Address { get; private set; }
public string ZipCode { get; private set; }
public virtual City City { get; private set; }
}
public class City
{
public int CityID { get; private set; }
public string Name { get; private set; }
}
Assuming that Value Objects in Domain-Driven Design have no identity, how can I map the above scenario into different tables, using EF Code-First? Is this approach possible?
I don't really like to have all fields of different addresses on the same customer table, but at the same time, i don't wanna make my domain dirty with identities for Value Objects.