The problem occurs only for value objects inside complex objects. The following example maps PhoneNumberType to int:
public enum PhoneNumberType
{
Mobile,
Home,
Work
}
public class PhoneNumber
{
public PhoneNumberType Type { get; set; }
public int Number { get; set; }
}
public class Contact
{
public PhoneNumber Phone { get; set; }
}
builder.OwnsOne(e => e.Phone).Property(p => p.Type);
builder.OwnsOne(e => e.Phone).Property(p => p.Number);