Given this class:
public class Basket
{
public int Id { get; set; }
private string SomeProperty { get; set; }
private Address Address { get; set; }
public class BasketMapper : EntityTypeConfiguration<Basket>
{
public BasketMapper()
{
//ValueType property is simple
Property(b => b.SomeProperty);
//Complex type needs all properties mapped
Property(b => b.Address.Street);
Property(b => b.Address.City);
Property(b => b.Address.CountryCode);
}
}
}
I want my Address
property to stay private, but I cannot use the Property(b=>b.Address)
because classes are not supported.
Is there a simple way to tell EF to map my Address
property as a complex type, the same way it would if it were a public property?
What I want to avoid is having to add all the properties of the Address to my BasketMapper
.