In my code first app I do have a class "customer" and "address". My client class has Address class reference. for instance
class Customer{
public string name {get;set;}
public Address address {get;set;}
}
class Address{
public string street{get;set;}
public string number{get;set;}
}
when I migrate these data I got one table customer with those columns:
name
address_street
address_number
It is great. My data is only in one table. It was perfect to me!.
However I need (for other reasons) add a ID for address.
class Address{
[Key]
public int EnderecoId { get; set; }
public string street{get;set;}
public string number{get;set;}
}
in this case the migration split my customer table into customer and address table.
name
addressId
and
street
number
There is any annotation that could avoid this ? I really would like to have address data inside customer table.