I have these entities:
public class Book
{
public int Id { get; set; }
public string Title { get; set; }
public List<Genre> Genres { get; set; }
}
public class Genre
{
public int Id { get; set; }
public string Name { get; set; }
public List<Book> Books { get; set; }
}
EF Core 5 can handle creating join table but how can I use this table and should I do it? For example, I'm sending response to add two existing genres to existing book (I have book and genres ids). I suppose it would be better to directly fill join table with this ids instead of first getting those entities from context and then adding Genre entities to Genres field of Book entity.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…