0
I have the following class in an application for C# practice purposes with Entityframework:
public class Livro
{
public Livro()
{
Autor = new HashSet<Autor>();
}
public int Id { get; set; }
public string Titulo { get; set; }
public int ISBN { get; set; }
public int GeneroId { get; set; }
public int AutorId { get; set; }
public virtual ICollection<Autor> Autor { get; set; }
public virtual Genero Genero { get; set; }
}
When I want to access class attributes Genero
, I make it like a normal class: Genero.Nome
, Genero.Id
, etc... Now, by the class Autor
, as it is a collection, I do not achieve the same result.
I wanted to know how to navigate through ICollection<Autor> Autor
to access its attributes.
Thank you.
Because you have a list of Authors of the Author class, but your Book class has an Autorid?
– Leandro Angelo