I have two entities, Service and Contract, their relationship must be one to one. the requirement is simple. how can I achieve this by means of data annotations or fluent api.
the following is the code that I have (Entity Service)
[ForeignKey("Contrato"]
public string NumeroLinea { get; set; }
public virtual Contrato Contrato { get; set; }
(Contract Entity)
public virtual Servicio Servicio {get; set; }
- > When I do the migration, it generates multiple errors.
the following is the error: Service_Contract_Source:: Multiplicity is not valid in Role 'Service_Contract_Source' in relationship 'Service_Contract'. Because the Dependent Role properties are not the key properties, the upper bound of the multiplicity of the Dependent Role must be '*'.