2
I have a relationship between Address and Academy where 1 address has 1 gym, and 1 gym has 1 address.
Academia class:
public class Academia
{
[Key]
public int AcademiaID { get; set; }
...
//relacionamentos
public int EnderecoID { get; set; }
public virtual Endereco Endereco { get; set; }
}
Address class
public class Endereco
{
[Key]
public int EnderecoID { get; set; }
...
public int LocalID { get; set; }
public virtual Local Local { get; set; }
}
When I do the Enable-Migration
I receive the following message:
Unable to determine the main end of an Association between the types 'Academia.Models.Endereco' and 'Academia.Models.Academia'. The main end of this Association must be explicitly configured using either the Relationship Fluent API or data Annotations.
From what I understand, Entity doesn’t know how to define who is the main one between the two classes