I'm having a difficulty with a mapping and would like to know if it's possible to do this:
I have a Contact class with two fields that are ValueObject of type "Phone", the fields are Phone and Cell.
public Telefone Telefone { get; set; }
public Telefone Celular { get; set; }
I would like to do the following mapping, so that Phone is mandatory and the cell phone is not:
Property(x => x.Telefone.DDD)
.HasColumnName("TelefoneDDD")
.IsRequired();
Property(x => x.Telefone.Numero)
.HasColumnName("Telefone")
.IsRequired();
Property(x => x.Celular.DDD)
.HasColumnName("CelularDDD")
.IsOptional();
Property(x => x.Celular.Numero)
.HasColumnName("Celular")
.IsOptional();
When I generate the migration, I get the following error:
Conflicting configuration settings were specified for property 'Number' on type 'System.Domain.ValueObject.Telephone': IsNullable = False conflicts with IsNullable = True