This question has already been answered:
Good day everyone! With the help of EF, added the Users and Audios tables, the EF itself automatically generated the third table for the link:
public class User { [Key] [DatabaseGenerated(DatabaseGeneratedOption.None)] public int Id { get; set; } public string Name { get; set; } public int Age { get; set; } public List<Audio> Audios { get; set; } } public class Audio { [Key] [DatabaseGenerated(DatabaseGeneratedOption.None)] public int Id { get; set; } public string Artist { get; set; } public string Title { get; set; } public List<User> Users { get; set; } } When I try to add a user with a list of audio recordings, everything is fine, but when I try to add another user with audio recordings that the first user has, he throws out an error saying that it’s impossible to add the same audio. If I delete from the second user the audio that is already in the database, the connection will not be established. I thought to fill in the user and the missing audio separately, and then directly using the sql query to add to the link table, but this method seems to be crutch and incorrect. I hope for your help!