0
I’m having an error in making an Migration... First I’ll say what I want, so you can understand, there’s inconsistency, but I’ve tried a lot and I couldn’t solve it.
What I mean by this modeling is that:
- A Sketch has several Images
- That a report has a sketch
- Croqui has a virtual report because he can access the Id laudo through the sketch itself(at least that’s how I think it works)
Models:
public class Croqui
{
[Key]
public int CroquId { get; set; }
[ ForeignKey("Laudo")]
public int LaudoId { get; set; }
public virtual Laudo Laudo { get; set; }
public virtual ICollection<Imagem> Imagens { get; set; }
}
Imagery
public class Imagem
{
public int ImagemId { get; set; }
public byte[] Image { get; set; }
public String ImagemTipo { get; set; }
public int CroquiId { get; set; }
public virtual Croqui croqui { get; set; }
}
Reports
public class Laudo
{
[Key]
public int LaudoId { get; set; }
[Display(Name = ("Ocupante"))]
public String Ocupante { get; set; }
[Display(Name = ("Ocupante ID"))]
public String IdOcupante { get; set; }
[Display(Name = ("Contato"))]
public String ContatoOcupante { get; set; }
[Display(Name = ("UF"))]
public String Estado { get; set; }
[Display(Name = ("Município"))]
public String Municipio { get; set; }
[Display(Name = ("Nº do Relatório"))]
public String NumeroRelatorio { get; set; }
public ICollection<Laudo> Laudos { get; set; }
public Croqui Croqui { get; set; }
Woe to error:
One or more validation errors Were Detected During model Generation: Croqui_laudo_source: Multiplicity is not Valid in Role >'Croqui_laudo_source' in Relationship 'Croqui_laudo'. Because the Dependent >Role properties are not the key properties, the upper bound of the >multiplicity of the Dependent Role must be '*'.
Thanks for your help.